diff options
Diffstat (limited to 'regress')
-rw-r--r-- | regress/multiplex.sh | 30 |
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 | ||
6 | tid="connection multiplexing" | 6 | tid="connection multiplexing" |
7 | 7 | ||
8 | if 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 | ||
14 | else | ||
15 | echo "skipped (no nc found)" | ||
16 | exit 0 | ||
17 | fi | ||
18 | |||
19 | trace "will use ProxyCommand $proxycmd" | ||
8 | if config_defined DISABLE_FD_PASSING ; then | 20 | if 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 | |||
27 | start_mux_master() | 39 | start_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}" | |||
74 | rm -f ${COPY} | 86 | rm -f ${COPY} |
75 | verbose "test $tid: forward" | 87 | verbose "test $tid: forward" |
76 | trace "forward over TCP/IP and check result" | 88 | trace "forward over TCP/IP and check result" |
77 | nc -N -l 127.0.0.1 $((${PORT} + 1)) < ${DATA} & | 89 | $NC -l 127.0.0.1 $((${PORT} + 1)) < ${DATA} & |
78 | netcat_pid=$! | 90 | netcat_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 |
80 | nc 127.0.0.1 $((${PORT} + 2)) > ${COPY} | 92 | $NC 127.0.0.1 $((${PORT} + 2)) > ${COPY} |
81 | cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}" | 93 | cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}" |
82 | kill $netcat_pid 2>/dev/null | 94 | kill $netcat_pid 2>/dev/null |
83 | rm -f ${COPY} $OBJ/unix-[123].fwd | 95 | rm -f ${COPY} $OBJ/unix-[123].fwd |
84 | 96 | ||
85 | trace "forward over UNIX and check result" | 97 | trace "forward over UNIX and check result" |
86 | nc -N -Ul $OBJ/unix-1.fwd < ${DATA} & | 98 | $NC -Ul $OBJ/unix-1.fwd < ${DATA} & |
87 | netcat_pid=$! | 99 | netcat_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 |
90 | nc -U $OBJ/unix-3.fwd > ${COPY} | 102 | $NC -U $OBJ/unix-3.fwd > ${COPY} |
91 | cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}" | 103 | cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}" |
92 | kill $netcat_pid 2>/dev/null | 104 | kill $netcat_pid 2>/dev/null |
93 | rm -f ${COPY} $OBJ/unix-[123].fwd | 105 | rm -f ${COPY} $OBJ/unix-[123].fwd |
@@ -138,22 +150,22 @@ ${SSH} -F $OBJ/ssh_config -p$P otherhost true \ | |||
138 | verbose "test $tid: cmd forward local (UNIX)" | 150 | verbose "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" |
141 | echo "" | nc -U $OBJ/unix-1.fwd | grep "Protocol mismatch" >/dev/null 2>&1 \ | 153 | echo "" | $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" |
145 | N=$(echo "" | nc -U $OBJ/unix-1.fwd 2>&1 | wc -l) | 157 | N=$(echo "" | $NC -U $OBJ/unix-1.fwd 2>&1 | wc -l) |
146 | test ${N} -eq 0 || fail "local forward path still listening" | 158 | test ${N} -eq 0 || fail "local forward path still listening" |
147 | rm -f $OBJ/unix-1.fwd | 159 | rm -f $OBJ/unix-1.fwd |
148 | 160 | ||
149 | verbose "test $tid: cmd forward remote (UNIX)" | 161 | verbose "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" |
152 | echo "" | nc -U $OBJ/unix-1.fwd | grep "Protocol mismatch" >/dev/null 2>&1 \ | 164 | echo "" | $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" |
156 | N=$(echo "" | nc -U $OBJ/unix-1.fwd 2>&1 | wc -l) | 168 | N=$(echo "" | $NC -U $OBJ/unix-1.fwd 2>&1 | wc -l) |
157 | test ${N} -eq 0 || fail "remote forward path still listening" | 169 | test ${N} -eq 0 || fail "remote forward path still listening" |
158 | rm -f $OBJ/unix-1.fwd | 170 | rm -f $OBJ/unix-1.fwd |
159 | 171 | ||