Otherwise, the clients could easily overflow the maximum packet size.
# Maximum packet size (default: 16k)
MaxPacketSize 16k
+ # Maximum size of a user comment (default: 100)
+ MaxCommentSize 100
+
#ifndef CONFIG_LOCAL
# Log to a given stream (configured below)
LogStream syslog
if (clist_size(&aa->tokens) >= aa->zone->allow_tokens)
cmd_error(c, "Maximum number of tokens was reached");
+ const char *comment = get_string(c->request, "comment");
+ if (comment && strlen(comment) > max_comment_size)
+ cmd_error(c, "Comment too long");
+
struct auth_token *at = auth_create_token(aa);
- char *tok = auth_set_token_generated(at, get_string(c->request, "comment"), c->pool);
+ char *tok = auth_set_token_generated(at, comment, c->pool);
set_string(c, c->reply, "token", tok);
msg(L_INFO, "Created token: login=<%s> zone=<%s> id=<%s>", aa->user->login, aa->zone->name, at->ident);
char *temp_key_file;
char *log_stream_name;
static uint max_packet_size = 16384;
+uint max_comment_size = 100;
static struct main_file listen_socket;
static uint num_connections;
CF_STRING("SocketPath", &socket_path),
CF_UINT("MaxConnections", &max_connections),
CF_UINT("MaxPacketSize", &max_packet_size),
+ CF_UINT("MaxCommentSize", &max_comment_size),
CF_LIST("Zone", &zone_list, &zone_config),
CF_STRING("Database", &database_name),
CF_STRING("TempKeyFile", &temp_key_file),
extern clist zone_list; // of struct auth_zone
extern char *database_name;
extern char *temp_key_file;
+extern uint max_comment_size;
/* cmd.c */