[test suite] added open/close file tests

This commit is contained in:
Michael Rash 2015-10-18 09:13:49 -07:00
parent 6c0b328114
commit 5597730e27
3 changed files with 28 additions and 6 deletions

View File

@ -1,8 +1,6 @@
SOURCE ANY
KEY_BASE64 wzNP62oPPgEc+kXDPQLHPOayQBuNbYUTPP+QrErNDmg=
HMAC_KEY_BASE64 Yh+xizBnl6FotC5ec7FanVGClRMlsOAPh2u6eovnerfBVKwaVKzjGoblFMHMc593TNyi0dWn4opLoTIV9q/ttg==
FW_ACCESS_TIMEOUT 3
#CMD_CYCLE_OPEN /some/cmd/to/execute -with -args test test
CMD_CYCLE_OPEN /usr/bin/touch /tmp/cmdcycle.test
CMD_CYCLE_CLOSE /some/closecmd/to/execute -test
CMD_CYCLE_TIMER 2
CMD_CYCLE_OPEN /usr/bin/touch /tmp/$IP
CMD_CYCLE_CLOSE /usr/bin/touch /tmp/2$IP
CMD_CYCLE_TIMER 1

View File

@ -917,6 +917,8 @@ my %test_keys = (
'server_access_file' => $OPTIONAL,
'server_conf_file' => $OPTIONAL,
'digest_cache_file' => $OPTIONAL,
'cmd_cycle_open_file' => $OPTIONAL,
'cmd_cycle_close_file' => $OPTIONAL,
'cmd_exec_file_owner' => $OPTIONAL,
'cmd_exec_file_not_created' => $OPTIONAL,
'rm_rule_mid_cycle' => $OPTIONAL,
@ -4737,6 +4739,26 @@ sub write_sudo_access_conf() {
return;
}
sub spa_cmd_open_close_exec_cycle() {
my $test_hr = shift;
for my $file ($test_hr->{'cmd_cycle_open_file'},
$test_hr->{'cmd_cycle_close_file'}) {
unlink $file if -e $file;
}
my $rv = &spa_cycle($test_hr);
for my $file ($test_hr->{'cmd_cycle_open_file'},
$test_hr->{'cmd_cycle_close_file'}) {
unless (-e $file) {
&write_test_file("[-] $file does not exist after SPA cycle.\n",
$curr_test_file);
$rv = 0;
}
}
return $rv;
}
sub spa_cmd_exec_cycle() {
my $test_hr = shift;

View File

@ -4,11 +4,13 @@
'category' => 'Rijndael+HMAC',
'subcategory' => 'client+server',
'detail' => 'cmd open/close cycle',
'function' => \&spa_cycle,
'function' => \&spa_cmd_open_close_exec_cycle,
'cmdline' => $default_client_hmac_args,
'fwknopd_cmdline' => "$fwknopdCmd -c $cf{'def'} -a $cf{'hmac_cmd_open_close_cycle_access'} " .
"-d $default_digest_file -p $default_pid_file $intf_str",
'fw_rule_created' => $REQUIRE_NO_NEW_RULE,
'cmd_cycle_open_file' => '/tmp/127.0.0.2',
'cmd_cycle_close_file' => '/tmp/2127.0.0.2',
'key_file' => $cf{'rc_hmac_b64_key'},
},
);