diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2016-12-16 01:06:28 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2016-12-16 01:06:28 +0000 |
commit | 45ee300a41d9ff553e1d32c5cf19b47d7fb30751 (patch) | |
tree | 776c74d511276c4e8ee502c2b385f9d6b0996597 | |
parent | 3cedd10d69ee3aab381e926f281e8610fe3527b7 (diff) |
Move the "stop sshd" code into its own helper function. Patch from
Zev Weiss <zev at bewilderbeest.net>, ok djm@
-rw-r--r-- | regress/usr.bin/ssh/login-timeout.sh | 4 | ||||
-rw-r--r-- | regress/usr.bin/ssh/reexec.sh | 11 | ||||
-rw-r--r-- | regress/usr.bin/ssh/test-exec.sh | 25 |
3 files changed, 21 insertions, 19 deletions
diff --git a/regress/usr.bin/ssh/login-timeout.sh b/regress/usr.bin/ssh/login-timeout.sh index eb76f554b45..12207fd99ee 100644 --- a/regress/usr.bin/ssh/login-timeout.sh +++ b/regress/usr.bin/ssh/login-timeout.sh @@ -1,4 +1,4 @@ -# $OpenBSD: login-timeout.sh,v 1.7 2014/03/13 20:44:49 djm Exp $ +# $OpenBSD: login-timeout.sh,v 1.8 2016/12/16 01:06:27 dtucker Exp $ # Placed in the Public Domain. tid="connect after login grace timeout" @@ -17,7 +17,7 @@ if [ $? -ne 0 ]; then fail "ssh connect after login grace timeout failed with privsep" fi -$SUDO kill `$SUDO cat $PIDFILE` +stop_sshd trace "test login grace without privsep" echo "UsePrivilegeSeparation no" >> $OBJ/sshd_config diff --git a/regress/usr.bin/ssh/reexec.sh b/regress/usr.bin/ssh/reexec.sh index 32ca0b820cf..dcb02bc0ee9 100644 --- a/regress/usr.bin/ssh/reexec.sh +++ b/regress/usr.bin/ssh/reexec.sh @@ -1,4 +1,4 @@ -# $OpenBSD: reexec.sh,v 1.9 2016/12/15 23:50:37 dtucker Exp $ +# $OpenBSD: reexec.sh,v 1.10 2016/12/16 01:06:27 dtucker Exp $ # Placed in the Public Domain. tid="reexec tests" @@ -39,8 +39,7 @@ echo "InvalidXXX=no" >> $OBJ/sshd_config copy_tests -$SUDO kill `$SUDO cat $PIDFILE` -rm -f $PIDFILE +stop_sshd cp $OBJ/sshd_config.orig $OBJ/sshd_config @@ -51,8 +50,7 @@ rm -f $SSHD_COPY copy_tests -$SUDO kill `$SUDO cat $PIDFILE` -rm -f $PIDFILE +stop_sshd verbose "test reexec fallback without privsep" @@ -64,7 +62,6 @@ rm -f $SSHD_COPY copy_tests -$SUDO kill `$SUDO cat $PIDFILE` -rm -f $PIDFILE +stop_sshd diff --git a/regress/usr.bin/ssh/test-exec.sh b/regress/usr.bin/ssh/test-exec.sh index bf03c52ce09..a9b41ec6bbc 100644 --- a/regress/usr.bin/ssh/test-exec.sh +++ b/regress/usr.bin/ssh/test-exec.sh @@ -1,4 +1,4 @@ -# $OpenBSD: test-exec.sh,v 1.57 2016/11/25 03:02:01 dtucker Exp $ +# $OpenBSD: test-exec.sh,v 1.58 2016/12/16 01:06:27 dtucker Exp $ # Placed in the Public Domain. USER=`id -un` @@ -158,16 +158,8 @@ increase_datafile_size() export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP #echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP -# helper -cleanup () +stop_sshd () { - if [ "x$SSH_PID" != "x" ]; then - if [ $SSH_PID -lt 2 ]; then - echo bad pid for ssh: $SSH_PID - else - kill $SSH_PID - fi - fi if [ -f $PIDFILE ]; then pid=`$SUDO cat $PIDFILE` if [ "X$pid" = "X" ]; then @@ -190,6 +182,19 @@ cleanup () fi } +# helper +cleanup () +{ + if [ "x$SSH_PID" != "x" ]; then + if [ $SSH_PID -lt 2 ]; then + echo bad pid for ssh: $SSH_PID + else + kill $SSH_PID + fi + fi + stop_sshd +} + start_debug_log () { echo "trace: $@" >$TEST_REGRESS_LOGFILE |