char *database_name = "subauthd.db";
char *temp_key_file;
char *log_stream_name;
+static uint max_packet_size = 16384;
static struct main_file listen_socket;
static uint num_connections;
-static byte packet_buffer[MAX_PACKET_SIZE];
+static byte *packet_buffer;
static byte oob_data_buffer[MAX_OOB_DATA_SIZE];
static int socket_read_handler(struct main_file *fi);
TRANS_TRY
{
struct fastbuf fb;
- fbbuf_init_write(&fb, packet_buffer, MAX_PACKET_SIZE);
+ fbbuf_init_write(&fb, packet_buffer, max_packet_size);
fb_tie(&fb);
json_write(c->json, &fb, c->reply);
len = fbbuf_count_written(&fb);
{
msg(L_ERROR, "Unable to construct reply, it is probably too long");
struct fastbuf fb2;
- fbbuf_init_write(&fb2, packet_buffer, MAX_PACKET_SIZE);
+ fbbuf_init_write(&fb2, packet_buffer, max_packet_size);
bputs(&fb2, "{ \"error\": \"Reply too long\" }\n");
len = fbbuf_count_written(&fb2);
}
struct iovec iov = {
.iov_base = packet_buffer,
- .iov_len = MAX_PACKET_SIZE,
+ .iov_len = max_packet_size,
};
struct msghdr mh = {
static void init_socket(void)
{
+ packet_buffer = xmalloc(max_packet_size);
+
int sk = socket(PF_UNIX, SOCK_SEQPACKET, 0);
if (sk < 0)
die("socket(PF_UNIX, SOCK_SEQPACKET): %m");
CF_ITEMS {
CF_STRING("SocketPath", &socket_path),
CF_UINT("MaxConnections", &max_connections),
+ CF_UINT("MaxPacketSize", &max_packet_size),
CF_LIST("Zone", &zone_list, &zone_config),
CF_STRING("Database", &database_name),
CF_STRING("TempKeyFile", &temp_key_file),