Interim commit to add a VERBOSE variable to fwknopd.
This commit is contained in:
@@ -1136,6 +1136,9 @@ parse_rc_param(fko_cli_options_t *options, const char *var_name, char * val)
|
||||
else
|
||||
parse_error = -1;
|
||||
}
|
||||
|
||||
if (parse_error == 0)
|
||||
log_set_verbosity(LOG_DEFAULT_VERBOSITY + options->verbose);
|
||||
}
|
||||
/* RESOLVE_IP_HTTP ? */
|
||||
else if (var->pos == FWKNOP_CLI_ARG_RESOLVE_IP_HTTP)
|
||||
|
||||
@@ -107,6 +107,7 @@ static char *config_map[NUMBER_OF_CONFIG_ENTRIES] = {
|
||||
#endif
|
||||
"GPG_HOME_DIR",
|
||||
"FIREWALL_EXE",
|
||||
"VERBOSITY"
|
||||
};
|
||||
|
||||
|
||||
|
||||
+18
-3
@@ -706,6 +706,10 @@ config_init(fko_srv_options_t *opts, int argc, char **argv)
|
||||
*/
|
||||
if(got_conf_file > 0)
|
||||
break;
|
||||
/* Verbosity level */
|
||||
case 'v':
|
||||
opts->verbose++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -755,6 +759,20 @@ config_init(fko_srv_options_t *opts, int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up the verbosity level according to the value found in the
|
||||
* config files */
|
||||
if (opts->config[CONF_VERBOSITY] != NULL)
|
||||
{
|
||||
opts->verbose = strtol_wrapper(opts->config[CONF_VERBOSITY], 0, -1,
|
||||
NO_EXIT_UPON_ERR, &is_err);
|
||||
if(is_err != FKO_SUCCESS)
|
||||
{
|
||||
log_msg(LOG_ERR, "[*] VERBOSITY value '%s' not in the range (>0)",
|
||||
opts->config[CONF_VERBOSITY]);
|
||||
clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset the options index so we can run through them again.
|
||||
*/
|
||||
optind = 0;
|
||||
@@ -852,9 +870,6 @@ config_init(fko_srv_options_t *opts, int argc, char **argv)
|
||||
case 'S':
|
||||
opts->status = 1;
|
||||
break;
|
||||
case 'v':
|
||||
opts->verbose++;
|
||||
break;
|
||||
case 'V':
|
||||
fprintf(stdout, "fwknopd server %s\n", MY_VERSION);
|
||||
clean_exit(opts, NO_FW_CLEANUP, EXIT_SUCCESS);
|
||||
|
||||
@@ -251,6 +251,7 @@ enum {
|
||||
#endif
|
||||
CONF_GPG_HOME_DIR,
|
||||
CONF_FIREWALL_EXE,
|
||||
CONF_VERBOSITY,
|
||||
|
||||
NUMBER_OF_CONFIG_ENTRIES /* Marks the end and number of entries */
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user