From 03456b931bf5edf169b4a8d4ef4c1cb2d46999fb Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Wed, 18 Feb 2015 11:45:01 +0200 Subject: [PATCH] Added "yes" and "no" to the config truth value check and added the function to the header. --- server/core/config.c | 4 ++-- server/include/config.h | 2 +- server/modules/filter/mqfilter.c | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/server/core/config.c b/server/core/config.c index a82827257..7137533d6 100644 --- a/server/core/config.c +++ b/server/core/config.c @@ -1810,11 +1810,11 @@ bool config_set_qualified_param( static int config_truth_value(char *str) { - if (strcasecmp(str, "true") == 0 || strcasecmp(str, "on") == 0) + if (strcasecmp(str, "true") == 0 || strcasecmp(str, "on") == 0 || strcasecmp(str, "yes") == 0) { return 1; } - if (strcasecmp(str, "false") == 0 || strcasecmp(str, "off") == 0) + if (strcasecmp(str, "false") == 0 || strcasecmp(str, "off") == 0 || strcasecmp(str, "no") == 0) { return 0; } diff --git a/server/include/config.h b/server/include/config.h index ca3092576..a41c845dd 100644 --- a/server/include/config.h +++ b/server/include/config.h @@ -107,7 +107,7 @@ extern unsigned int config_pollsleep(); CONFIG_PARAMETER* config_get_param(CONFIG_PARAMETER* params, const char* name); config_param_type_t config_get_paramtype(CONFIG_PARAMETER* param); CONFIG_PARAMETER* config_clone_param(CONFIG_PARAMETER* param); - +static int config_truth_value(char *str); bool config_set_qualified_param( CONFIG_PARAMETER* param, void* val, diff --git a/server/modules/filter/mqfilter.c b/server/modules/filter/mqfilter.c index 86059c7bc..e614cf7b4 100644 --- a/server/modules/filter/mqfilter.c +++ b/server/modules/filter/mqfilter.c @@ -510,6 +510,7 @@ createInstance(char **options, FILTER_PARAMETER **params) }else if(!strcmp(params[i]->name,"ssl_client_key")){ my_instance->ssl_client_key = strdup(params[i]->value); + }else if(!strcmp(params[i]->name,"ssl_CA_cert")){ my_instance->ssl_CA_cert = strdup(params[i]->value); @@ -617,11 +618,11 @@ createInstance(char **options, FILTER_PARAMETER **params) } }else if(!strcmp(paramlist[i]->name,"logging_log_all")){ - if(!strcmp(paramlist[i]->value,"true")){ + if(config_truth_value(paramlist[i]->value)){ my_instance->log_all = true; } }else if(!strcmp(paramlist[i]->name,"logging_strict")){ - if(strcmp(paramlist[i]->value,"false") == 0){ + if(!config_truth_value(paramlist[i]->value)){ my_instance->strict_logging = false; } }