]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream commit
authordtucker@openbsd.org <dtucker@openbsd.org>
Fri, 16 Dec 2016 01:06:27 +0000 (01:06 +0000)
committerDamien Miller <djm@mindrot.org>
Fri, 16 Dec 2016 02:16:34 +0000 (13:16 +1100)
Move the "stop sshd" code into its own helper function.
Patch from Zev Weiss <zev at bewilderbeest.net>, ok djm@

Upstream-Regress-ID: a113dea77df5bd97fb4633ea31f3d72dbe356329

regress/login-timeout.sh
regress/reexec.sh
regress/test-exec.sh

index eb76f554b4599a57b3c11ada3c79e98387b000a9..12207fd99ee79c84e6cc8f443338078a58000e79 100644 (file)
@@ -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
index 6ac648fd3260d3267c2c7275e304677ee097c3b1..72957d4cd263d5d761db1f6a78fc072e987d7679 100644 (file)
@@ -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
 
@@ -54,8 +53,7 @@ rm -f $SSHD_COPY
 
 copy_tests
 
-$SUDO kill `$SUDO cat $PIDFILE`
-rm -f $PIDFILE
+stop_sshd
 
 verbose "test reexec fallback without privsep"
 
@@ -67,7 +65,6 @@ rm -f $SSHD_COPY
 
 copy_tests
 
-$SUDO kill `$SUDO cat $PIDFILE`
-rm -f $PIDFILE
+stop_sshd
 
 fi
index 5d48706d43b455859caf643df9222f7a0c196d43..bfa48803b561b5671d770ca21cd22f8428e1710d 100644 (file)
@@ -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.
 
 #SUDO=sudo
@@ -293,16 +293,8 @@ md5 () {
 }
 # End of portable specific functions
 
-# 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
@@ -325,6 +317,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