summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/forwarding.sh40
1 files changed, 19 insertions, 21 deletions
diff --git a/regress/forwarding.sh b/regress/forwarding.sh
index ef4f3b3c4..cd634f2f6 100644
--- a/regress/forwarding.sh
+++ b/regress/forwarding.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: forwarding.sh,v 1.22 2019/07/20 09:37:31 dtucker Exp $ 1# $OpenBSD: forwarding.sh,v 1.23 2019/07/20 09:50:58 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="local and remote forwarding" 4tid="local and remote forwarding"
@@ -7,8 +7,6 @@ DATA=/bin/ls${EXEEXT}
7 7
8start_sshd 8start_sshd
9 9
10SLEEPTIME=${SLEEPTIME:-10}
11
12base=33 10base=33
13last=$PORT 11last=$PORT
14fwd="" 12fwd=""
@@ -28,7 +26,7 @@ done
28 26
29trace "start forwarding, fork to background" 27trace "start forwarding, fork to background"
30rm -f $CTL 28rm -f $CTL
31${SSH} -S $CTL -M -F $OBJ/ssh_config -f $fwd somehost sleep ${SLEEPTIME} 29${SSH} -S $CTL -N -M -F $OBJ/ssh_config -f $fwd somehost
32 30
33trace "transfer over forwarded channels and check result" 31trace "transfer over forwarded channels and check result"
34${SSH} -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \ 32${SSH} -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \
@@ -36,7 +34,7 @@ ${SSH} -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \
36test -s ${COPY} || fail "failed copy of ${DATA}" 34test -s ${COPY} || fail "failed copy of ${DATA}"
37cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}" 35cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
38 36
39${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 37${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 2>/dev/null
40 38
41for d in L R; do 39for d in L R; do
42 trace "exit on -$d forward failure" 40 trace "exit on -$d forward failure"
@@ -71,8 +69,8 @@ ${SSH} -F $OBJ/ssh_config -oClearAllForwardings=yes somehost true
71 69
72trace "clear local forward" 70trace "clear local forward"
73rm -f $CTL 71rm -f $CTL
74${SSH} -S $CTL -M -f -F $OBJ/ssh_config -L ${base}01:127.0.0.1:$PORT \ 72${SSH} -S $CTL -N -M -f -F $OBJ/ssh_config -L ${base}01:127.0.0.1:$PORT \
75 -oClearAllForwardings=yes somehost sleep ${SLEEPTIME} 73 -oClearAllForwardings=yes somehost
76if [ $? != 0 ]; then 74if [ $? != 0 ]; then
77 fail "connection failed with cleared local forwarding" 75 fail "connection failed with cleared local forwarding"
78else 76else
@@ -81,12 +79,12 @@ else
81 >>$TEST_REGRESS_LOGFILE 2>&1 && \ 79 >>$TEST_REGRESS_LOGFILE 2>&1 && \
82 fail "local forwarding not cleared" 80 fail "local forwarding not cleared"
83fi 81fi
84${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 82${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 2>/dev/null
85 83
86trace "clear remote forward" 84trace "clear remote forward"
87rm -f $CTL 85rm -f $CTL
88${SSH} -S $CTL -M -f -F $OBJ/ssh_config -R ${base}01:127.0.0.1:$PORT \ 86${SSH} -S $CTL -N -M -f -F $OBJ/ssh_config -R ${base}01:127.0.0.1:$PORT \
89 -oClearAllForwardings=yes somehost sleep ${SLEEPTIME} 87 -oClearAllForwardings=yes somehost
90if [ $? != 0 ]; then 88if [ $? != 0 ]; then
91 fail "connection failed with cleared remote forwarding" 89 fail "connection failed with cleared remote forwarding"
92else 90else
@@ -95,7 +93,7 @@ else
95 >>$TEST_REGRESS_LOGFILE 2>&1 && \ 93 >>$TEST_REGRESS_LOGFILE 2>&1 && \
96 fail "remote forwarding not cleared" 94 fail "remote forwarding not cleared"
97fi 95fi
98${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 96${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 2>/dev/null
99 97
100trace "stdio forwarding" 98trace "stdio forwarding"
101cmd="${SSH} -F $OBJ/ssh_config" 99cmd="${SSH} -F $OBJ/ssh_config"
@@ -109,7 +107,7 @@ echo "RemoteForward ${base}02 127.0.0.1:${base}01" >> $OBJ/ssh_config
109 107
110trace "config file: start forwarding, fork to background" 108trace "config file: start forwarding, fork to background"
111rm -f $CTL 109rm -f $CTL
112${SSH} -S $CTL -M -F $OBJ/ssh_config -f somehost sleep ${SLEEPTIME} 110${SSH} -S $CTL -N -M -F $OBJ/ssh_config -f somehost
113 111
114trace "config file: transfer over forwarded channels and check result" 112trace "config file: transfer over forwarded channels and check result"
115${SSH} -F $OBJ/ssh_config -p${base}02 -o 'ConnectionAttempts=4' \ 113${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' \
117test -s ${COPY} || fail "failed copy of ${DATA}" 115test -s ${COPY} || fail "failed copy of ${DATA}"
118cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}" 116cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
119 117
120${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 118${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 2>/dev/null
121 119
122trace "transfer over chained unix domain socket forwards and check result" 120trace "transfer over chained unix domain socket forwards and check result"
123rm -f $OBJ/unix-[123].fwd 121rm -f $OBJ/unix-[123].fwd
124rm -f $CTL $CTL.[123] 122rm -f $CTL $CTL.[123]
125${SSH} -S $CTL -M -f -F $OBJ/ssh_config -R${base}01:[$OBJ/unix-1.fwd] somehost sleep ${SLEEPTIME} 123${SSH} -S $CTL -N -M -f -F $OBJ/ssh_config -R${base}01:[$OBJ/unix-1.fwd] somehost
126${SSH} -S $CTL.1 -M -f -F $OBJ/ssh_config -L[$OBJ/unix-1.fwd]:[$OBJ/unix-2.fwd] somehost sleep ${SLEEPTIME} 124${SSH} -S $CTL.1 -N -M -f -F $OBJ/ssh_config -L[$OBJ/unix-1.fwd]:[$OBJ/unix-2.fwd] somehost
127${SSH} -S $CTL.2 -M -f -F $OBJ/ssh_config -R[$OBJ/unix-2.fwd]:[$OBJ/unix-3.fwd] somehost sleep ${SLEEPTIME} 125${SSH} -S $CTL.2 -N -M -f -F $OBJ/ssh_config -R[$OBJ/unix-2.fwd]:[$OBJ/unix-3.fwd] somehost
128${SSH} -S $CTL.3 -M -f -F $OBJ/ssh_config -L[$OBJ/unix-3.fwd]:127.0.0.1:$PORT somehost sleep ${SLEEPTIME} 126${SSH} -S $CTL.3 -N -M -f -F $OBJ/ssh_config -L[$OBJ/unix-3.fwd]:127.0.0.1:$PORT somehost
129${SSH} -F $OBJ/ssh_config -p${base}01 -o 'ConnectionAttempts=4' \ 127${SSH} -F $OBJ/ssh_config -p${base}01 -o 'ConnectionAttempts=4' \
130 somehost cat ${DATA} > ${COPY} 128 somehost cat ${DATA} > ${COPY}
131test -s ${COPY} || fail "failed copy ${DATA}" 129test -s ${COPY} || fail "failed copy ${DATA}"
132cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}" 130cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
133 131
134${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 132${SSH} -F $OBJ/ssh_config -S $CTL -O exit somehost 2>/dev/null
135${SSH} -F $OBJ/ssh_config -S $CTL.1 -O exit somehost 133${SSH} -F $OBJ/ssh_config -S $CTL.1 -O exit somehost 2>/dev/null
136${SSH} -F $OBJ/ssh_config -S $CTL.2 -O exit somehost 134${SSH} -F $OBJ/ssh_config -S $CTL.2 -O exit somehost 2>/dev/null
137${SSH} -F $OBJ/ssh_config -S $CTL.3 -O exit somehost 135${SSH} -F $OBJ/ssh_config -S $CTL.3 -O exit somehost 2>/dev/null
138 136