summaryrefslogtreecommitdiff
path: root/regress/usr.bin/ssh
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2019-07-20 09:50:59 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2019-07-20 09:50:59 +0000
commit6dee4c177ad767c3db8445d6ecf5950df4189553 (patch)
tree93dc765c71cb9f9f0bb78d679a56ece52f35dfa9 /regress/usr.bin/ssh
parentdc68de60ec1d2d3feb515e1105b6659959250756 (diff)
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.
Diffstat (limited to 'regress/usr.bin/ssh')
-rw-r--r--regress/usr.bin/ssh/forwarding.sh40
1 files changed, 19 insertions, 21 deletions
diff --git a/regress/usr.bin/ssh/forwarding.sh b/regress/usr.bin/ssh/forwarding.sh
index 53e569b80b1..017274ffec0 100644
--- a/regress/usr.bin/ssh/forwarding.sh
+++ b/regress/usr.bin/ssh/forwarding.sh
@@ -1,12 +1,10 @@
-# $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"
start_sshd
-SLEEPTIME=${SLEEPTIME:-10}
-
base=33
last=$PORT
fwd=""
@@ -25,7 +23,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' \
@@ -33,7 +31,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"
@@ -68,8 +66,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
@@ -78,12 +76,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
@@ -92,7 +90,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"
@@ -106,7 +104,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' \
@@ -114,22 +112,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