}
else if (!strcmp(args[0], "ca-base")) {
#ifdef USE_OPENSSL
+ if(alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.ca_base != NULL) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
}
else if (!strcmp(args[0], "crt-base")) {
#ifdef USE_OPENSSL
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.crt_base != NULL) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
#endif
}
else if (!strcmp(args[0], "daemon")) {
+ if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ goto out;
global.mode |= MODE_DAEMON;
}
else if (!strcmp(args[0], "debug")) {
+ if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ goto out;
global.mode |= MODE_DEBUG;
}
else if (!strcmp(args[0], "noepoll")) {
+ if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ goto out;
global.tune.options &= ~GTUNE_USE_EPOLL;
}
else if (!strcmp(args[0], "nokqueue")) {
+ if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ goto out;
global.tune.options &= ~GTUNE_USE_KQUEUE;
}
else if (!strcmp(args[0], "nopoll")) {
+ if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ goto out;
global.tune.options &= ~GTUNE_USE_POLL;
}
else if (!strcmp(args[0], "nosplice")) {
+ if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ goto out;
global.tune.options &= ~GTUNE_USE_SPLICE;
}
else if (!strcmp(args[0], "nogetaddrinfo")) {
+ if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ goto out;
global.tune.options &= ~GTUNE_USE_GAI;
}
else if (!strcmp(args[0], "quiet")) {
+ if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ goto out;
global.mode |= MODE_QUIET;
}
else if (!strcmp(args[0], "tune.maxpollevents")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.tune.maxpollevents != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.tune.maxpollevents = atol(args[1]);
}
else if (!strcmp(args[0], "tune.maxaccept")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.tune.maxaccept != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.tune.maxaccept = atol(args[1]);
}
else if (!strcmp(args[0], "tune.chksize")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
}
#ifdef USE_OPENSSL
else if (!strcmp(args[0], "tune.ssl.force-private-cache")) {
+ if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ goto out;
global.tune.sslprivatecache = 1;
}
else if (!strcmp(args[0], "tune.ssl.cachesize")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
unsigned int ssllifetime;
const char *res;
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects ssl sessions <lifetime> in seconds as argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
global.tune.ssllifetime = ssllifetime;
}
else if (!strcmp(args[0], "tune.ssl.maxrecord")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
global.tune.ssl_max_record = atol(args[1]);
}
else if (!strcmp(args[0], "tune.ssl.default-dh-param")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
}
#endif
else if (!strcmp(args[0], "tune.buffers.limit")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
}
}
else if (!strcmp(args[0], "tune.buffers.reserve")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
global.tune.buf_limit = global.tune.reserved_bufs + 1;
}
else if (!strcmp(args[0], "tune.bufsize")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
alloc_trash_buffers(global.tune.bufsize);
}
else if (!strcmp(args[0], "tune.maxrewrite")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
unsigned int idle;
const char *res;
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects a timer value between 0 and 65535 ms.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
global.tune.idle_timer = idle;
}
else if (!strcmp(args[0], "tune.rcvbuf.client")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.tune.client_rcvbuf != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.tune.client_rcvbuf = atol(args[1]);
}
else if (!strcmp(args[0], "tune.rcvbuf.server")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.tune.server_rcvbuf != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.tune.server_rcvbuf = atol(args[1]);
}
else if (!strcmp(args[0], "tune.sndbuf.client")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.tune.client_sndbuf != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.tune.client_sndbuf = atol(args[1]);
}
else if (!strcmp(args[0], "tune.sndbuf.server")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.tune.server_sndbuf != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.tune.server_sndbuf = atol(args[1]);
}
else if (!strcmp(args[0], "tune.pipesize")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
global.tune.pipesize = atol(args[1]);
}
else if (!strcmp(args[0], "tune.http.cookielen")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
global.tune.cookie_len = atol(args[1]) + 1;
}
else if (!strcmp(args[0], "tune.http.maxhdr")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
}
else if (!strcmp(args[0], "tune.zlib.memlevel")) {
#ifdef USE_ZLIB
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*args[1]) {
global.tune.zlibmemlevel = atoi(args[1]);
if (global.tune.zlibmemlevel < 1 || global.tune.zlibmemlevel > 9) {
}
else if (!strcmp(args[0], "tune.zlib.windowsize")) {
#ifdef USE_ZLIB
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*args[1]) {
global.tune.zlibwindowsize = atoi(args[1]);
if (global.tune.zlibwindowsize < 8 || global.tune.zlibwindowsize > 15) {
#endif
}
else if (!strcmp(args[0], "tune.comp.maxlevel")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*args[1]) {
global.tune.comp_maxlevel = atoi(args[1]);
if (global.tune.comp_maxlevel < 1 || global.tune.comp_maxlevel > 9) {
}
}
else if (!strcmp(args[0], "uid")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.uid != 0) {
Alert("parsing [%s:%d] : user/uid already specified. Continuing.\n", file, linenum);
err_code |= ERR_ALERT;
global.uid = atol(args[1]);
}
else if (!strcmp(args[0], "gid")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.gid != 0) {
Alert("parsing [%s:%d] : group/gid already specified. Continuing.\n", file, linenum);
err_code |= ERR_ALERT;
global.gid = atol(args[1]);
}
else if (!strcmp(args[0], "external-check")) {
+ if (alertif_too_many_args(0, file, linenum, args, &err_code))
+ goto out;
global.external_check = 1;
}
/* user/group name handling */
else if (!strcmp(args[0], "user")) {
struct passwd *ha_user;
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.uid != 0) {
Alert("parsing [%s:%d] : user/uid already specified. Continuing.\n", file, linenum);
err_code |= ERR_ALERT;
}
else if (!strcmp(args[0], "group")) {
struct group *ha_group;
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.gid != 0) {
Alert("parsing [%s:%d] : gid/group was already specified. Continuing.\n", file, linenum);
err_code |= ERR_ALERT;
}
/* end of user/group name handling*/
else if (!strcmp(args[0], "nbproc")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
}
}
else if (!strcmp(args[0], "maxconn")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.maxconn != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
}
else if (!strcmp(args[0], "maxsslconn")) {
#ifdef USE_OPENSSL
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
}
else if (!strcmp(args[0], "ssl-default-bind-ciphers")) {
#ifdef USE_OPENSSL
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects a cipher suite as an argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
}
else if (!strcmp(args[0], "ssl-default-server-ciphers")) {
#ifdef USE_OPENSSL
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects a cipher suite as an argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
#endif
}
else if (!strcmp(args[0], "ssl-server-verify")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
}
}
else if (!strcmp(args[0], "maxconnrate")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.cps_lim != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.cps_lim = atol(args[1]);
}
else if (!strcmp(args[0], "maxsessrate")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.sps_lim != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.sps_lim = atol(args[1]);
}
else if (!strcmp(args[0], "maxsslrate")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.ssl_lim != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.ssl_lim = atol(args[1]);
}
else if (!strcmp(args[0], "maxcomprate")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument in kb/s.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
global.comp_rate_lim = atoi(args[1]) * 1024;
}
else if (!strcmp(args[0], "maxpipes")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.maxpipes != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.maxpipes = atol(args[1]);
}
else if (!strcmp(args[0], "maxzlibmem")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
global.maxzlibmem = atol(args[1]) * 1024L * 1024L;
}
else if (!strcmp(args[0], "maxcompcpuusage")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects an integer argument between 0 and 100.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
-}
+ }
else if (!strcmp(args[0], "ulimit-n")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.rlimit_nofile != 0) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
global.rlimit_nofile = atol(args[1]);
}
else if (!strcmp(args[0], "chroot")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.chroot != NULL) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
int i;
char c;
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
+
for (i=0; args[1][i]; i++) {
c = args[1][i];
if (!isupper((unsigned char)c) && !islower((unsigned char)c) &&
global.node = strdup(args[1]);
}
else if (!strcmp(args[0], "pidfile")) {
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.pidfile != NULL) {
Alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
err_code |= ERR_ALERT;
int arg = 0;
int len = 0;
+ if (alertif_too_many_args(8, file, linenum, args, &err_code)) /* does not strictly check optional arguments */
+ goto out;
+
if (*(args[1]) == 0 || *(args[2]) == 0) {
Alert("parsing [%s:%d] : '%s' expects <address> and <facility> as arguments.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
logline = realloc(logline, global.max_syslog_len + 1);
}
+ if (alertif_too_many_args_idx(3, arg + 1, file, linenum, args, &err_code))
+ goto out;
+
logsrv->facility = get_log_facility(args[arg+2]);
if (logsrv->facility < 0) {
Alert("parsing [%s:%d] : unknown log facility '%s'\n", file, linenum, args[arg+2]);
snprintf(global.log_send_hostname, len + 2, "%s ", name);
}
else if (!strcmp(args[0], "log-tag")) { /* tag to report to syslog */
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d] : '%s' expects a tag for use in syslog.\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
global.log_tag = strdup(args[1]);
}
else if (!strcmp(args[0], "spread-checks")) { /* random time between checks (0-50) */
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (global.spread_checks != 0) {
Alert("parsing [%s:%d]: spread-checks already specified. Continuing.\n", file, linenum);
err_code |= ERR_ALERT;
const char *err;
unsigned int val;
-
+ if (alertif_too_many_args(1, file, linenum, args, &err_code))
+ goto out;
if (*(args[1]) == 0) {
Alert("parsing [%s:%d]: '%s' expects an integer argument (0..50).\n", file, linenum, args[0]);
err_code |= ERR_ALERT | ERR_FATAL;
goto out;
}
+ if (alertif_too_many_args_idx(4, 1, file, linenum, args, &err_code))
+ goto out;
+
if (*(args[4]) == 0) {
Alert("parsing [%s:%d] : '%s' expects 'cookie' <cookie_name> 'len' <len>.\n",
file, linenum, args[0]);
goto out;
}
+ if (alertif_too_many_args_idx(4, 1, file, linenum, args, &err_code))
+ goto out;
+
if (*(args[3]) == 0 || strcmp(args[4], "len") != 0 || *(args[5]) == 0) {
Alert("parsing [%s:%d] : '%s %s' expects 'header' <header_name> 'len' <len>.\n",
file, linenum, args[0], args[1]);
goto out;
}
+ if (alertif_too_many_args_idx(4, 1, file, linenum, args, &err_code))
+ goto out;
+
if (*(args[3]) == 0 || strcmp(args[4], "len") != 0 || *(args[5]) == 0) {
Alert("parsing [%s:%d] : '%s %s' expects 'header' <header_name> 'len' <len>.\n",
file, linenum, args[0], args[1]);