summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/multiplex.sh30
1 files changed, 21 insertions, 9 deletions
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index 9f5fc38ea..5ef9049d1 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -5,6 +5,18 @@ CTL=/tmp/openssh.regress.ctl-sock.$$
5 5
6tid="connection multiplexing" 6tid="connection multiplexing"
7 7
8if have_prog nc ; then
9 if nc -h 2>&1 | grep -- -N >/dev/null; then
10 NC="nc -N";
11 else
12 NC="nc"
13 fi
14else
15 echo "skipped (no nc found)"
16 exit 0
17fi
18
19trace "will use ProxyCommand $proxycmd"
8if config_defined DISABLE_FD_PASSING ; then 20if config_defined DISABLE_FD_PASSING ; then
9 echo "skipped (not supported on this platform)" 21 echo "skipped (not supported on this platform)"
10 exit 0 22 exit 0
@@ -27,7 +39,7 @@ start_sshd
27start_mux_master() 39start_mux_master()
28{ 40{
29 trace "start master, fork to background" 41 trace "start master, fork to background"
30 ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost \ 42 ${SSH} -n2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost \
31 -E $TEST_REGRESS_LOGFILE 2>&1 & 43 -E $TEST_REGRESS_LOGFILE 2>&1 &
32 # NB. $SSH_PID will be killed by test-exec.sh:cleanup on fatal errors. 44 # NB. $SSH_PID will be killed by test-exec.sh:cleanup on fatal errors.
33 SSH_PID=$! 45 SSH_PID=$!
@@ -74,20 +86,20 @@ cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}"
74rm -f ${COPY} 86rm -f ${COPY}
75verbose "test $tid: forward" 87verbose "test $tid: forward"
76trace "forward over TCP/IP and check result" 88trace "forward over TCP/IP and check result"
77nc -N -l 127.0.0.1 $((${PORT} + 1)) < ${DATA} & 89$NC -l 127.0.0.1 $((${PORT} + 1)) < ${DATA} &
78netcat_pid=$! 90netcat_pid=$!
79${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L127.0.0.1:$((${PORT} + 2)):127.0.0.1:$((${PORT} + 1)) otherhost >>$TEST_SSH_LOGFILE 2>&1 91${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L127.0.0.1:$((${PORT} + 2)):127.0.0.1:$((${PORT} + 1)) otherhost >>$TEST_SSH_LOGFILE 2>&1
80nc 127.0.0.1 $((${PORT} + 2)) > ${COPY} 92$NC 127.0.0.1 $((${PORT} + 2)) > ${COPY}
81cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}" 93cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}"
82kill $netcat_pid 2>/dev/null 94kill $netcat_pid 2>/dev/null
83rm -f ${COPY} $OBJ/unix-[123].fwd 95rm -f ${COPY} $OBJ/unix-[123].fwd
84 96
85trace "forward over UNIX and check result" 97trace "forward over UNIX and check result"
86nc -N -Ul $OBJ/unix-1.fwd < ${DATA} & 98$NC -Ul $OBJ/unix-1.fwd < ${DATA} &
87netcat_pid=$! 99netcat_pid=$!
88${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L$OBJ/unix-2.fwd:$OBJ/unix-1.fwd otherhost >>$TEST_SSH_LOGFILE 2>&1 100${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L$OBJ/unix-2.fwd:$OBJ/unix-1.fwd otherhost >>$TEST_SSH_LOGFILE 2>&1
89${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R$OBJ/unix-3.fwd:$OBJ/unix-2.fwd otherhost >>$TEST_SSH_LOGFILE 2>&1 101${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R$OBJ/unix-3.fwd:$OBJ/unix-2.fwd otherhost >>$TEST_SSH_LOGFILE 2>&1
90nc -U $OBJ/unix-3.fwd > ${COPY} 102$NC -U $OBJ/unix-3.fwd > ${COPY}
91cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}" 103cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}"
92kill $netcat_pid 2>/dev/null 104kill $netcat_pid 2>/dev/null
93rm -f ${COPY} $OBJ/unix-[123].fwd 105rm -f ${COPY} $OBJ/unix-[123].fwd
@@ -138,22 +150,22 @@ ${SSH} -F $OBJ/ssh_config -p$P otherhost true \
138verbose "test $tid: cmd forward local (UNIX)" 150verbose "test $tid: cmd forward local (UNIX)"
139${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L $OBJ/unix-1.fwd:localhost:$PORT otherhost \ 151${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L $OBJ/unix-1.fwd:localhost:$PORT otherhost \
140 || fail "request local forward failed" 152 || fail "request local forward failed"
141echo "" | nc -U $OBJ/unix-1.fwd | grep "Protocol mismatch" >/dev/null 2>&1 \ 153echo "" | $NC -U $OBJ/unix-1.fwd | grep "Protocol mismatch" >/dev/null 2>&1 \
142 || fail "connect to local forward path failed" 154 || fail "connect to local forward path failed"
143${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -L $OBJ/unix-1.fwd:localhost:$PORT otherhost \ 155${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -L $OBJ/unix-1.fwd:localhost:$PORT otherhost \
144 || fail "cancel local forward failed" 156 || fail "cancel local forward failed"
145N=$(echo "" | nc -U $OBJ/unix-1.fwd 2>&1 | wc -l) 157N=$(echo "" | $NC -U $OBJ/unix-1.fwd 2>&1 | wc -l)
146test ${N} -eq 0 || fail "local forward path still listening" 158test ${N} -eq 0 || fail "local forward path still listening"
147rm -f $OBJ/unix-1.fwd 159rm -f $OBJ/unix-1.fwd
148 160
149verbose "test $tid: cmd forward remote (UNIX)" 161verbose "test $tid: cmd forward remote (UNIX)"
150${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R $OBJ/unix-1.fwd:localhost:$PORT otherhost \ 162${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R $OBJ/unix-1.fwd:localhost:$PORT otherhost \
151 || fail "request remote forward failed" 163 || fail "request remote forward failed"
152echo "" | nc -U $OBJ/unix-1.fwd | grep "Protocol mismatch" >/dev/null 2>&1 \ 164echo "" | $NC -U $OBJ/unix-1.fwd | grep "Protocol mismatch" >/dev/null 2>&1 \
153 || fail "connect to remote forwarded path failed" 165 || fail "connect to remote forwarded path failed"
154${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -R $OBJ/unix-1.fwd:localhost:$PORT otherhost \ 166${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -R $OBJ/unix-1.fwd:localhost:$PORT otherhost \
155 || fail "cancel remote forward failed" 167 || fail "cancel remote forward failed"
156N=$(echo "" | nc -U $OBJ/unix-1.fwd 2>&1 | wc -l) 168N=$(echo "" | $NC -U $OBJ/unix-1.fwd 2>&1 | wc -l)
157test ${N} -eq 0 || fail "remote forward path still listening" 169test ${N} -eq 0 || fail "remote forward path still listening"
158rm -f $OBJ/unix-1.fwd 170rm -f $OBJ/unix-1.fwd
159 171