[openssh-commits] [openssh] 03/03: upstream: Remove the sleeps and thus races from the forwarding

git+noreply at mindrot.org git+noreply at mindrot.org
Sat Jul 20 22:14:05 AEST 2019


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 41e22c2e05cb950b704945ac9408f6109c9b7848
Author: dtucker at openbsd.org <dtucker at openbsd.org>
Date:   Sat Jul 20 09:50:58 2019 +0000

    upstream: Remove the sleeps and thus races from the forwarding
    
    test.  They were originally required to work with Protocol 1, but now we can
    use ssh -N and the control socket without the sleeps. While there, suppress
    output fro the control exit commands.
    
    OpenBSD-Regress-ID: 4c51a1d651242f12c90074c18c61008a74c1c790
---
 regress/forwarding.sh | 40 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/regress/forwarding.sh b/regress/forwarding.sh
index ef4f3b3c..cd634f2f 100644
--- a/regress/forwarding.sh
+++ b/regress/forwarding.sh
@@ -1,4 +1,4 @@
-#	$OpenBSD: forwarding.sh,v 1.22 2019/07/20 09:37:31 dtucker Exp $
+#	$OpenBSD: forwarding.sh,v 1.23 2019/07/20 09:50:58 dtucker Exp $
 #	Placed in the Public Domain.
 
 tid="local and remote forwarding"
@@ -7,8 +7,6 @@ DATA=/bin/ls${EXEEXT}
 
 start_sshd
 
-SLEEPTIME=${SLEEPTIME:-10}
-
 base=33
 last=$PORT
 fwd=""
@@ -28,7 +26,7 @@ done
 
 trace "start forwarding, fork to background"
 rm -f $CTL
-${SSH} -S $CTL -M -F $OBJ/ssh_config -f $fwd somehost sleep ${SLEEPTIME}
+${SSH} -S $CTL -N -M -F $OBJ/ssh_config -f $fwd somehost
 
 trace "transfer over forwarded channels and check result"
 ${SSH} -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \
@@ -36,7 +34,7 @@ ${SSH} -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \
 test -s ${COPY}		|| fail "failed copy of ${DATA}"
 cmp ${DATA} ${COPY}	|| fail "corrupted copy of ${DATA}"
 
-${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost
+${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 2>/dev/null
 
 for d in L R; do
 	trace "exit on -$d forward failure"
@@ -71,8 +69,8 @@ ${SSH} -F $OBJ/ssh_config -oClearAllForwardings=yes somehost true
 
 trace "clear local forward"
 rm -f $CTL
-${SSH} -S $CTL -M -f -F $OBJ/ssh_config -L ${base}01:127.0.0.1:$PORT \
-    -oClearAllForwardings=yes somehost sleep ${SLEEPTIME}
+${SSH} -S $CTL -N -M -f -F $OBJ/ssh_config -L ${base}01:127.0.0.1:$PORT \
+    -oClearAllForwardings=yes somehost
 if [ $? != 0 ]; then
 	fail "connection failed with cleared local forwarding"
 else
@@ -81,12 +79,12 @@ else
 	     >>$TEST_REGRESS_LOGFILE 2>&1 && \
 		fail "local forwarding not cleared"
 fi
-${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost
+${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 2>/dev/null
 
 trace "clear remote forward"
 rm -f $CTL
-${SSH} -S $CTL -M -f -F $OBJ/ssh_config -R ${base}01:127.0.0.1:$PORT \
-    -oClearAllForwardings=yes somehost sleep ${SLEEPTIME}
+${SSH} -S $CTL -N -M -f -F $OBJ/ssh_config -R ${base}01:127.0.0.1:$PORT \
+    -oClearAllForwardings=yes somehost
 if [ $? != 0 ]; then
 	fail "connection failed with cleared remote forwarding"
 else
@@ -95,7 +93,7 @@ else
 	     >>$TEST_REGRESS_LOGFILE 2>&1 && \
 		fail "remote forwarding not cleared"
 fi
-${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost
+${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 2>/dev/null
 
 trace "stdio forwarding"
 cmd="${SSH} -F $OBJ/ssh_config"
@@ -109,7 +107,7 @@ echo "RemoteForward ${base}02 127.0.0.1:${base}01" >> $OBJ/ssh_config
 
 trace "config file: start forwarding, fork to background"
 rm -f $CTL
-${SSH} -S $CTL -M -F $OBJ/ssh_config -f somehost sleep ${SLEEPTIME}
+${SSH} -S $CTL -N -M -F $OBJ/ssh_config -f somehost
 
 trace "config file: transfer over forwarded channels and check result"
 ${SSH} -F $OBJ/ssh_config -p${base}02 -o 'ConnectionAttempts=4' \
@@ -117,22 +115,22 @@ ${SSH} -F $OBJ/ssh_config -p${base}02 -o 'ConnectionAttempts=4' \
 test -s ${COPY}		|| fail "failed copy of ${DATA}"
 cmp ${DATA} ${COPY}	|| fail "corrupted copy of ${DATA}"
 
-${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost
+${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 2>/dev/null
 
 trace "transfer over chained unix domain socket forwards and check result"
 rm -f $OBJ/unix-[123].fwd
 rm -f $CTL $CTL.[123]
-${SSH} -S $CTL -M -f -F $OBJ/ssh_config -R${base}01:[$OBJ/unix-1.fwd] somehost sleep ${SLEEPTIME}
-${SSH} -S $CTL.1 -M -f -F $OBJ/ssh_config -L[$OBJ/unix-1.fwd]:[$OBJ/unix-2.fwd] somehost sleep ${SLEEPTIME}
-${SSH} -S $CTL.2 -M -f -F $OBJ/ssh_config -R[$OBJ/unix-2.fwd]:[$OBJ/unix-3.fwd] somehost sleep ${SLEEPTIME}
-${SSH} -S $CTL.3 -M -f -F $OBJ/ssh_config -L[$OBJ/unix-3.fwd]:127.0.0.1:$PORT somehost sleep ${SLEEPTIME}
+${SSH} -S $CTL -N -M -f -F $OBJ/ssh_config -R${base}01:[$OBJ/unix-1.fwd] somehost
+${SSH} -S $CTL.1 -N -M -f -F $OBJ/ssh_config -L[$OBJ/unix-1.fwd]:[$OBJ/unix-2.fwd] somehost
+${SSH} -S $CTL.2 -N -M -f -F $OBJ/ssh_config -R[$OBJ/unix-2.fwd]:[$OBJ/unix-3.fwd] somehost
+${SSH} -S $CTL.3 -N -M -f -F $OBJ/ssh_config -L[$OBJ/unix-3.fwd]:127.0.0.1:$PORT somehost
 ${SSH} -F $OBJ/ssh_config -p${base}01 -o 'ConnectionAttempts=4' \
 	somehost cat ${DATA} > ${COPY}
 test -s ${COPY}			|| fail "failed copy ${DATA}"
 cmp ${DATA} ${COPY}		|| fail "corrupted copy of ${DATA}"
 
-${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost
-${SSH} -F $OBJ/ssh_config -S $CTL.1 -O exit somehost
-${SSH} -F $OBJ/ssh_config -S $CTL.2 -O exit somehost
-${SSH} -F $OBJ/ssh_config -S $CTL.3 -O exit somehost
+${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 2>/dev/null
+${SSH} -F $OBJ/ssh_config -S $CTL.1 -O exit somehost 2>/dev/null
+${SSH} -F $OBJ/ssh_config -S $CTL.2 -O exit somehost 2>/dev/null
+${SSH} -F $OBJ/ssh_config -S $CTL.3 -O exit somehost 2>/dev/null
 

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list