diff --git a/server/modules/filter/qlafilter.c b/server/modules/filter/qlafilter.c index 2167f17e8..8e999c9aa 100644 --- a/server/modules/filter/qlafilter.c +++ b/server/modules/filter/qlafilter.c @@ -170,30 +170,33 @@ int i; my_instance->source = NULL; my_instance->match = NULL; my_instance->nomatch = NULL; - for (i = 0; params[i]; i++) + if (params) { - if (!strcmp(params[i]->name, "match")) + for (i = 0; params[i]; i++) { - my_instance->match = strdup(params[i]->value); - } - else if (!strcmp(params[i]->name, "exclude")) - { - my_instance->nomatch = strdup(params[i]->value); - } - else if (!strcmp(params[i]->name, "source")) - my_instance->source = strdup(params[i]->value); - else if (!strcmp(params[i]->name, "filebase")) - { - if (my_instance->filebase) - free(my_instance->filebase); - my_instance->source = strdup(params[i]->value); - } - else if (!filter_standard_parameter(params[i]->name)) - { - LOGIF(LE, (skygw_log_write_flush( - LOGFILE_ERROR, - "qlafilter: Unexpected parameter '%s'.\n", - params[i]->name))); + if (!strcmp(params[i]->name, "match")) + { + my_instance->match = strdup(params[i]->value); + } + else if (!strcmp(params[i]->name, "exclude")) + { + my_instance->nomatch = strdup(params[i]->value); + } + else if (!strcmp(params[i]->name, "source")) + my_instance->source = strdup(params[i]->value); + else if (!strcmp(params[i]->name, "filebase")) + { + if (my_instance->filebase) + free(my_instance->filebase); + my_instance->source = strdup(params[i]->value); + } + else if (!filter_standard_parameter(params[i]->name)) + { + LOGIF(LE, (skygw_log_write_flush( + LOGFILE_ERROR, + "qlafilter: Unexpected parameter '%s'.\n", + params[i]->name))); + } } } my_instance->sessions = 0; diff --git a/server/modules/filter/regexfilter.c b/server/modules/filter/regexfilter.c index 0eaf50825..106dd73d8 100644 --- a/server/modules/filter/regexfilter.c +++ b/server/modules/filter/regexfilter.c @@ -137,7 +137,7 @@ int i, cflags = REG_ICASE; my_instance->match = NULL; my_instance->replace = NULL; - for (i = 0; params[i]; i++) + for (i = 0; params && params[i]; i++) { if (!strcmp(params[i]->name, "match")) my_instance->match = strdup(params[i]->value); @@ -152,22 +152,25 @@ int i, cflags = REG_ICASE; } } - for (i = 0; options[i]; i++) + if (options) { - if (!strcasecmp(options[i], "ignorecase")) + for (i = 0; options[i]; i++) { - cflags |= REG_ICASE; - } - else if (!strcasecmp(options[i], "case")) - { - cflags &= ~REG_ICASE; - } - else - { - LOGIF(LE, (skygw_log_write_flush( - LOGFILE_ERROR, - "regexfilter: unsupported option '%s'.\n", - options[i]))); + if (!strcasecmp(options[i], "ignorecase")) + { + cflags |= REG_ICASE; + } + else if (!strcasecmp(options[i], "case")) + { + cflags &= ~REG_ICASE; + } + else + { + LOGIF(LE, (skygw_log_write_flush( + LOGFILE_ERROR, + "regexfilter: unsupported option '%s'.\n", + options[i]))); + } } } diff --git a/server/modules/filter/topfilter.c b/server/modules/filter/topfilter.c index 747306125..48102be5e 100644 --- a/server/modules/filter/topfilter.c +++ b/server/modules/filter/topfilter.c @@ -183,7 +183,7 @@ TOPN_INSTANCE *my_instance; my_instance->exclude = NULL; my_instance->source = NULL; my_instance->filebase = strdup("top"); - for (i = 0; params[i]; i++) + for (i = 0; params && params[i]; i++) { if (!strcmp(params[i]->name, "count")) my_instance->topN = atoi(params[i]->value); @@ -210,6 +210,12 @@ TOPN_INSTANCE *my_instance; params[i]->name))); } } + if (options) + { + LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR, + "topfilter: Options are not supported by this " + " filter. They will be ignored\n"))); + } my_instance->sessions = 0; if (my_instance->match && regcomp(&my_instance->re, my_instance->match, REG_ICASE))