From 8c3a67377e479fd41b7e540c7d909a8f00973f79 Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Tue, 30 Oct 2012 21:23:30 -0400 Subject: [PATCH] [test suite] bug fix to ensure binary existence check in build security tests --- test/test-fwknop.pl | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/test-fwknop.pl b/test/test-fwknop.pl index 05d3e35a..04da82c5 100755 --- a/test/test-fwknop.pl +++ b/test/test-fwknop.pl @@ -4634,56 +4634,56 @@ sub generic_exec() { ### check for PIE sub pie_binary() { my $test_hr = shift; - return 0 unless $test_hr->{'binary'}; + return 0 unless -e $test_hr->{'binary'}; &run_cmd("./hardening-check $test_hr->{'binary'}", $cmd_out_tmp, $current_test_file); - return 0 if &file_find_regex([qr/Position\sIndependent.*:\sno/i], + return 1 if &file_find_regex([qr/Position\sIndependent.*:\syes/i], $MATCH_ALL, $current_test_file); - return 1; + return 0; } ### check for stack protection sub stack_protected_binary() { my $test_hr = shift; - return 0 unless $test_hr->{'binary'}; + return 0 unless -e $test_hr->{'binary'}; &run_cmd("./hardening-check $test_hr->{'binary'}", $cmd_out_tmp, $current_test_file); - return 0 if &file_find_regex([qr/Stack\sprotected.*:\sno/i], + return 1 if &file_find_regex([qr/Stack\sprotected.*:\syes/i], $MATCH_ALL, $current_test_file); - return 1; + return 0; } ### check for fortified source functions sub fortify_source_functions() { my $test_hr = shift; - return 0 unless $test_hr->{'binary'}; + return 0 unless -e $test_hr->{'binary'}; &run_cmd("./hardening-check $test_hr->{'binary'}", $cmd_out_tmp, $current_test_file); - return 0 if &file_find_regex([qr/Fortify\sSource\sfunctions:\sno/i], + return 1 if &file_find_regex([qr/Fortify\sSource\sfunctions:\syes/i], $MATCH_ALL, $current_test_file); - return 1; + return 0; } ### check for read-only relocations sub read_only_relocations() { my $test_hr = shift; - return 0 unless $test_hr->{'binary'}; + return 0 unless -e $test_hr->{'binary'}; &run_cmd("./hardening-check $test_hr->{'binary'}", $cmd_out_tmp, $current_test_file); - return 0 if &file_find_regex([qr/Read.only\srelocations:\sno/i], + return 1 if &file_find_regex([qr/Read.only\srelocations:\syes/i], $MATCH_ALL, $current_test_file); - return 1; + return 0; } ### check for immediate binding sub immediate_binding() { my $test_hr = shift; - return 0 unless $test_hr->{'binary'}; + return 0 unless -e $test_hr->{'binary'}; &run_cmd("./hardening-check $test_hr->{'binary'}", $cmd_out_tmp, $current_test_file); - return 0 if &file_find_regex([qr/Immediate\sbinding:\sno/i], + return 1 if &file_find_regex([qr/Immediate\sbinding:\syes/i], $MATCH_ALL, $current_test_file); - return 1; + return 0; } sub specs() {