[server] alert the user when config file variable expansion references invalid var

This commit is contained in:
Michael Rash 2014-07-07 22:30:49 -05:00
parent 0e5c4644fc
commit 3c06948414

View File

@ -257,13 +257,6 @@ parse_config_file(fko_srv_options_t *opts, const char *config_file)
continue; continue;
} }
/*
fprintf(stderr,
"CONF FILE: %s, LINE: %s\tVar: %s, Val: '%s'\n",
config_file, conf_line_buf, var, val
);
*/
good_ent = 0; good_ent = 0;
for(i=0; i<NUMBER_OF_CONFIG_ENTRIES; i++) for(i=0; i<NUMBER_OF_CONFIG_ENTRIES; i++)
{ {
@ -282,6 +275,15 @@ parse_config_file(fko_srv_options_t *opts, const char *config_file)
strlcpy(val, opts->config[cndx], sizeof(val)); strlcpy(val, opts->config[cndx], sizeof(val));
strlcat(val, tmp2, sizeof(val)); strlcat(val, tmp2, sizeof(val));
} }
else
{
/* We didn't map the embedded variable to a valid
* config parameter
*/
log_msg(LOG_ERR,
"[*] Invalid embedded variable in: '%s'", val);
break;
}
} }
} }
@ -760,7 +762,6 @@ config_init(fko_srv_options_t *opts, int argc, char **argv)
case 'h': case 'h':
usage(); usage();
clean_exit(opts, NO_FW_CLEANUP, EXIT_SUCCESS); clean_exit(opts, NO_FW_CLEANUP, EXIT_SUCCESS);
break;
/* Look for configuration file arg. /* Look for configuration file arg.
*/ */
@ -974,7 +975,6 @@ config_init(fko_srv_options_t *opts, int argc, char **argv)
case 'V': case 'V':
fprintf(stdout, "fwknopd server %s\n", MY_VERSION); fprintf(stdout, "fwknopd server %s\n", MY_VERSION);
clean_exit(opts, NO_FW_CLEANUP, EXIT_SUCCESS); clean_exit(opts, NO_FW_CLEANUP, EXIT_SUCCESS);
break;
default: default:
usage(); usage();
clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE); clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);