Added "yes" and "no" to the config truth value check and added the function to the header.

This commit is contained in:
Markus Makela
2015-02-18 11:45:01 +02:00
parent da029140cd
commit 03456b931b
3 changed files with 6 additions and 5 deletions

View File

@ -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;
}

View File

@ -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,

View File

@ -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;
}
}