Make sure that cleanup() function is always called

Added {HEADERFILE_BREACH} to temporary files that should be removed
Removed obsolete cleanup calls
This commit is contained in:
Peter Mosmans 2014-11-18 14:30:48 +11:00
parent cf8fa2c3f3
commit de0b4313b8

View File

@ -83,7 +83,8 @@ OSSL_VER_APPENDIX="none"
NODEIP="" NODEIP=""
IPS="" IPS=""
# make sure that temporary files are cleaned up after use
trap cleanup QUIT EXIT
out() { out() {
$ECHO "$1" $ECHO "$1"
@ -1565,7 +1566,7 @@ cleanup () {
[ -e $HEADERFILE_BREACH ] && cat $HEADERFILE_BREACH [ -e $HEADERFILE_BREACH ] && cat $HEADERFILE_BREACH
#[ -e $LOGFILE ] && cat $LOGFILE #[ -e $LOGFILE ] && cat $LOGFILE
else else
rm $TMPFILE $HEADERFILE $LOGFILE $GOST_CONF 2>/dev/null rm ${TMPFILE} ${HEADERFILE} ${HEADERFILE_BREACH} ${LOGFILE} ${GOST_CONF} 2>/dev/null
fi fi
outln outln
outln outln
@ -1795,56 +1796,48 @@ case "$1" in
maketempf maketempf
test_just_one $2 test_just_one $2
ret=$? ret=$?
cleanup
exit $ret ;; exit $ret ;;
-t|--starttls) -t|--starttls)
parse_hn_port "$2" "$3" # here comes hostname:port and protocol to signal starttls parse_hn_port "$2" "$3" # here comes hostname:port and protocol to signal starttls
maketempf maketempf
starttls "$3" # protocol starttls "$3" # protocol
ret=$? ret=$?
cleanup
exit $ret ;; exit $ret ;;
-e|--each-cipher) -e|--each-cipher)
parse_hn_port "$2" parse_hn_port "$2"
maketempf maketempf
allciphers allciphers
ret=$? ret=$?
cleanup
exit $ret ;; exit $ret ;;
-E|-ee|--cipher-per-proto) -E|-ee|--cipher-per-proto)
parse_hn_port "$2" parse_hn_port "$2"
maketempf maketempf
cipher_per_proto cipher_per_proto
ret=$? ret=$?
cleanup
exit $ret ;; exit $ret ;;
-p|--protocols) -p|--protocols)
parse_hn_port "$2" parse_hn_port "$2"
maketempf maketempf
runprotocols ; ret=$? runprotocols ; ret=$?
spdy ; ret=`expr $? + $ret` spdy ; ret=`expr $? + $ret`
cleanup
exit $ret ;; exit $ret ;;
-f|--ciphers) -f|--ciphers)
parse_hn_port "$2" parse_hn_port "$2"
maketempf maketempf
run_std_cipherlists run_std_cipherlists
ret=$? ret=$?
cleanup
exit $ret ;; exit $ret ;;
-P|--preference) -P|--preference)
parse_hn_port "$2" parse_hn_port "$2"
maketempf maketempf
simple_preference simple_preference
ret=$? ret=$?
cleanup
exit $ret ;; exit $ret ;;
-y|--spdy|--google) -y|--spdy|--google)
parse_hn_port "$2" parse_hn_port "$2"
maketempf maketempf
spdy spdy
ret=$? ret=$?
cleanup
exit $? ;; exit $? ;;
-B|--heartbleet) -B|--heartbleet)
parse_hn_port "$2" parse_hn_port "$2"
@ -1852,7 +1845,6 @@ case "$1" in
outln; blue "--> Testing for heartbleed vulnerability"; outln "\n" outln; blue "--> Testing for heartbleed vulnerability"; outln "\n"
heartbleed heartbleed
ret=$? ret=$?
cleanup
exit $? ;; exit $? ;;
-I|--ccs|--ccs_injection) -I|--ccs|--ccs_injection)
parse_hn_port "$2" parse_hn_port "$2"
@ -1860,7 +1852,6 @@ case "$1" in
outln; blue "--> Testing for CCS injection vulnerability"; outln "\n" outln; blue "--> Testing for CCS injection vulnerability"; outln "\n"
ccs_injection ccs_injection
ret=$? ret=$?
cleanup
exit $? ;; exit $? ;;
-R|--renegotiation) -R|--renegotiation)
parse_hn_port "$2" parse_hn_port "$2"
@ -1868,7 +1859,6 @@ case "$1" in
outln; blue "--> Testing for Renegotiation vulnerability"; outln "\n" outln; blue "--> Testing for Renegotiation vulnerability"; outln "\n"
renego renego
ret=$? ret=$?
cleanup
exit $? ;; exit $? ;;
-C|--compression|--crime) -C|--compression|--crime)
parse_hn_port "$2" parse_hn_port "$2"
@ -1876,7 +1866,6 @@ case "$1" in
outln; blue "--> Testing for CRIME vulnerability"; outln "\n" outln; blue "--> Testing for CRIME vulnerability"; outln "\n"
crime crime
ret=$? ret=$?
cleanup
exit $? ;; exit $? ;;
-T|--breach) -T|--breach)
parse_hn_port "$2" parse_hn_port "$2"
@ -1885,7 +1874,6 @@ case "$1" in
breach breach
ret=$? ret=$?
ret=`expr $? + $ret` ret=`expr $? + $ret`
cleanup
exit $ret ;; exit $ret ;;
-0|--poodle) -0|--poodle)
parse_hn_port "$2" parse_hn_port "$2"
@ -1894,21 +1882,18 @@ case "$1" in
poodle poodle
ret=$? ret=$?
ret=`expr $? + $ret` ret=`expr $? + $ret`
cleanup
exit $ret ;; exit $ret ;;
-4|--rc4|--appelbaum) -4|--rc4|--appelbaum)
parse_hn_port "$2" parse_hn_port "$2"
maketempf maketempf
rc4 rc4
ret=$? ret=$?
cleanup
exit $? ;; exit $? ;;
-s|--pfs|--fs|--nsa) -s|--pfs|--fs|--nsa)
parse_hn_port "$2" parse_hn_port "$2"
maketempf maketempf
pfs pfs
ret=$? ret=$?
cleanup
exit $ret ;; exit $ret ;;
-H|--header|--headers) -H|--header|--headers)
parse_hn_port "$2" parse_hn_port "$2"
@ -1919,7 +1904,6 @@ case "$1" in
ret=$? ret=$?
serverbanner serverbanner
ret=`expr $? + $ret` ret=`expr $? + $ret`
cleanup
exit $ret ;; exit $ret ;;
*) *)
parse_hn_port "$1" parse_hn_port "$1"
@ -1946,8 +1930,6 @@ case "$1" in
rc4 ; ret=`expr $? + $ret` rc4 ; ret=`expr $? + $ret`
pfs ; ret=`expr $? + $ret` pfs ; ret=`expr $? + $ret`
cleanup
exit $ret ;; exit $ret ;;
esac esac