Updated to define a default gpg keyring path of /root/.gnupg, and if the GPG_HOME_DIR variable
is not defined in the fwknopd.conf file or the access.conf file, then this default will take over. git-svn-id: file:///home/mbr/svn/fwknop/trunk@252 510a4753-2344-4c79-9c09-4d669213fbeb
This commit is contained in:
parent
a0b813ca55
commit
688ae8d4f0
@ -497,7 +497,7 @@ process_rc(fko_cli_options_t *options)
|
||||
if(strcasecmp(curr_stanza, "default") == 0)
|
||||
{
|
||||
if(parse_rc_param(options, var, val) < 0)
|
||||
fprintf(stderr, "Parameter error in %s, line %i: var=%s, val=%i\n",
|
||||
fprintf(stderr, "Parameter error in %s, line %i: var=%s, val=%s\n",
|
||||
rcfile, line_num, var, val);
|
||||
}
|
||||
else if(options->use_rc_stanza[0] != '\0'
|
||||
@ -506,7 +506,7 @@ process_rc(fko_cli_options_t *options)
|
||||
options->got_named_stanza = 1;
|
||||
if(parse_rc_param(options, var, val) < 0)
|
||||
fprintf(stderr,
|
||||
"Parameter error in %s, stanza: %s, line %i: var=%s, val=%i\n",
|
||||
"Parameter error in %s, stanza: %s, line %i: var=%s, val=%s\n",
|
||||
rcfile, curr_stanza, line_num, var, val);
|
||||
}
|
||||
|
||||
@ -577,6 +577,19 @@ validate_options(fko_cli_options_t *options)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Establish a few defaults such as UDP/62201 for sending the SPA
|
||||
* packet (can be changed with --server-proto/--server-port)
|
||||
*/
|
||||
static void
|
||||
set_defaults(fko_cli_options_t *options)
|
||||
{
|
||||
options->spa_proto = FKO_DEFAULT_PROTO;
|
||||
options->spa_dst_port = FKO_DEFAULT_PORT;
|
||||
options->fw_timeout = -1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Initialize program configuration via config file and/or command-line
|
||||
* switches.
|
||||
*/
|
||||
@ -589,12 +602,9 @@ config_init(fko_cli_options_t *options, int argc, char **argv)
|
||||
*/
|
||||
memset(options, 0x00, sizeof(fko_cli_options_t));
|
||||
|
||||
/* Establish a few defaults such as UDP/62201 for sending the SPA
|
||||
* packet (can be changed with --server-proto/--server-port)
|
||||
/* Make sure a few reasonable defaults are set
|
||||
*/
|
||||
options->spa_proto = FKO_DEFAULT_PROTO;
|
||||
options->spa_dst_port = FKO_DEFAULT_PORT;
|
||||
options->fw_timeout = -1;
|
||||
set_defaults(options);
|
||||
|
||||
/* First pass over cmd_line args to see if a named-stanza in the
|
||||
* rc file is used.
|
||||
|
||||
@ -569,12 +569,16 @@ set_acc_defaults(fko_srv_options_t *opts)
|
||||
|
||||
while(acc)
|
||||
{
|
||||
/* fw_access_timeout is the only one that need a default fallback
|
||||
* (so far).
|
||||
/* set default fw_access_timeout if necessary
|
||||
*/
|
||||
if(acc->fw_access_timeout < 1)
|
||||
acc->fw_access_timeout = DEF_FW_ACCESS_TIMEOUT;
|
||||
|
||||
/* set default gpg keyring path if necessary
|
||||
*/
|
||||
if(acc->gpg_home_dir == NULL)
|
||||
add_acc_string(&(acc->gpg_home_dir), opts->config[CONF_GPG_HOME_DIR]);
|
||||
|
||||
acc = acc->next;
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,6 +265,13 @@ validate_options(fko_srv_options_t *opts)
|
||||
if(opts->config[CONF_SYSLOG_FACILITY] == NULL)
|
||||
set_config_entry(opts, CONF_SYSLOG_FACILITY, "LOG_DAEMON");
|
||||
|
||||
/* If the GPG_HOME_DIR variable is not set in the config file and the
|
||||
* --gpg-home-dir option was not specified on the command line, set the
|
||||
* default gpg keyring path.
|
||||
*/
|
||||
if(opts->config[CONF_GPG_HOME_DIR] == NULL)
|
||||
set_config_entry(opts, CONF_GPG_HOME_DIR, GPG_DEFAULT_KEYRING);
|
||||
|
||||
/* Some options just trigger some output of information, or trigger an
|
||||
* external function, but do not actually start fwknopd. If any of those
|
||||
* are set, we can return here an skip the validation routines as all
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user