[test suite] set sudo path on the fwknopd command line

This commit is contained in:
Michael Rash 2015-08-21 22:24:45 -04:00
parent e999f61f82
commit dd1528c829
3 changed files with 25 additions and 2 deletions

View File

@ -1262,7 +1262,7 @@ config_init(fko_srv_options_t *opts, int argc, char **argv)
else
{
log_msg(LOG_ERR,
"[*] gpg path '%s' could not stat()/does not exist?",
"[*] gpg path '%s' could not stat()/not executable?",
optarg);
clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
}
@ -1330,7 +1330,7 @@ config_init(fko_srv_options_t *opts, int argc, char **argv)
else
{
log_msg(LOG_ERR,
"[*] gpg path '%s' could not stat()/does not exist?",
"[*] sudo path '%s' could not stat()/not executable?",
optarg);
clean_exit(opts, NO_FW_CLEANUP, EXIT_FAILURE);
}
@ -1448,6 +1448,8 @@ usage(void)
" done in the access.conf file).\n"
" --gpg-exe - Specify the path to GPG (this is normally done in\n"
" the access.conf file).\n"
" --sudo-exe - Specify the path to sudo (the default path is\n"
" /usr/bin/sudo).\n"
" --no-firewd-check-support\n"
" - Disable test for 'firewall-cmd ... -C' support.\n"
" --no-ipt-check-support - Disable test for 'iptables -C' support.\n"

View File

@ -4735,6 +4735,11 @@ sub spa_cmd_exec_cycle() {
### we need to write the access.conf file based on sudo
### requirements
&write_sudo_access_conf($test_hr);
### make sure the path to sudo is set properly
if ($test_hr->{'fwknopd_cmdline'}) {
$test_hr->{'fwknopd_cmdline'} .= " --sudo-exe $sudo_path";
}
}
if (-e $cmd_exec_test_file) {

View File

@ -435,6 +435,22 @@
'exec_err' => $YES,
'cmdline' => "$fwknopdCmd $default_server_conf_args --gpg-exe /invalid/path"
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'sudo invalid binary path (1)',
'function' => \&generic_exec,
'exec_err' => $YES,
'cmdline' => "$fwknopdCmd $default_server_conf_args --sudo-exe /invalid/path"
},
{
'category' => 'basic operations',
'subcategory' => 'server',
'detail' => 'sudo invalid binary path (2)',
'function' => \&generic_exec,
'exec_err' => $YES,
'cmdline' => "$fwknopdCmd $default_server_conf_args --sudo-exe /etc/hosts"
},
{
'category' => 'basic operations',