diff options
Diffstat (limited to 'regress/multiplex.sh')
-rw-r--r-- | regress/multiplex.sh | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/regress/multiplex.sh b/regress/multiplex.sh index 0a9ed2fbf..9f5fc38ea 100644 --- a/regress/multiplex.sh +++ b/regress/multiplex.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: multiplex.sh,v 1.23 2014/07/07 08:15:26 djm Exp $ | 1 | # $OpenBSD: multiplex.sh,v 1.24 2014/07/15 15:54:15 millert Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | CTL=/tmp/openssh.regress.ctl-sock.$$ | 4 | CTL=/tmp/openssh.regress.ctl-sock.$$ |
@@ -72,6 +72,25 @@ test -f ${COPY} || fail "scp: failed copy ${DATA}" | |||
72 | cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" | 72 | cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" |
73 | 73 | ||
74 | rm -f ${COPY} | 74 | rm -f ${COPY} |
75 | verbose "test $tid: forward" | ||
76 | trace "forward over TCP/IP and check result" | ||
77 | nc -N -l 127.0.0.1 $((${PORT} + 1)) < ${DATA} & | ||
78 | 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 | ||
80 | nc 127.0.0.1 $((${PORT} + 2)) > ${COPY} | ||
81 | cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}" | ||
82 | kill $netcat_pid 2>/dev/null | ||
83 | rm -f ${COPY} $OBJ/unix-[123].fwd | ||
84 | |||
85 | trace "forward over UNIX and check result" | ||
86 | nc -N -Ul $OBJ/unix-1.fwd < ${DATA} & | ||
87 | 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 | ||
89 | ${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} | ||
91 | cmp ${DATA} ${COPY} || fail "ssh: corrupted copy of ${DATA}" | ||
92 | kill $netcat_pid 2>/dev/null | ||
93 | rm -f ${COPY} $OBJ/unix-[123].fwd | ||
75 | 94 | ||
76 | for s in 0 1 4 5 44; do | 95 | for s in 0 1 4 5 44; do |
77 | trace "exit status $s over multiplexed connection" | 96 | trace "exit status $s over multiplexed connection" |
@@ -96,7 +115,7 @@ verbose "test $tid: cmd check" | |||
96 | ${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost >>$TEST_REGRESS_LOGFILE 2>&1 \ | 115 | ${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost >>$TEST_REGRESS_LOGFILE 2>&1 \ |
97 | || fail "check command failed" | 116 | || fail "check command failed" |
98 | 117 | ||
99 | verbose "test $tid: cmd forward local" | 118 | verbose "test $tid: cmd forward local (TCP)" |
100 | ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L $P:localhost:$PORT otherhost \ | 119 | ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L $P:localhost:$PORT otherhost \ |
101 | || fail "request local forward failed" | 120 | || fail "request local forward failed" |
102 | ${SSH} -F $OBJ/ssh_config -p$P otherhost true \ | 121 | ${SSH} -F $OBJ/ssh_config -p$P otherhost true \ |
@@ -106,7 +125,7 @@ ${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -L $P:localhost:$PORT otherhost \ | |||
106 | ${SSH} -F $OBJ/ssh_config -p$P otherhost true \ | 125 | ${SSH} -F $OBJ/ssh_config -p$P otherhost true \ |
107 | && fail "local forward port still listening" | 126 | && fail "local forward port still listening" |
108 | 127 | ||
109 | verbose "test $tid: cmd forward remote" | 128 | verbose "test $tid: cmd forward remote (TCP)" |
110 | ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R $P:localhost:$PORT otherhost \ | 129 | ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R $P:localhost:$PORT otherhost \ |
111 | || fail "request remote forward failed" | 130 | || fail "request remote forward failed" |
112 | ${SSH} -F $OBJ/ssh_config -p$P otherhost true \ | 131 | ${SSH} -F $OBJ/ssh_config -p$P otherhost true \ |
@@ -116,6 +135,28 @@ ${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -R $P:localhost:$PORT otherhost \ | |||
116 | ${SSH} -F $OBJ/ssh_config -p$P otherhost true \ | 135 | ${SSH} -F $OBJ/ssh_config -p$P otherhost true \ |
117 | && fail "remote forward port still listening" | 136 | && fail "remote forward port still listening" |
118 | 137 | ||
138 | verbose "test $tid: cmd forward local (UNIX)" | ||
139 | ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L $OBJ/unix-1.fwd:localhost:$PORT otherhost \ | ||
140 | || fail "request local forward failed" | ||
141 | echo "" | nc -U $OBJ/unix-1.fwd | grep "Protocol mismatch" >/dev/null 2>&1 \ | ||
142 | || fail "connect to local forward path failed" | ||
143 | ${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -L $OBJ/unix-1.fwd:localhost:$PORT otherhost \ | ||
144 | || fail "cancel local forward failed" | ||
145 | N=$(echo "" | nc -U $OBJ/unix-1.fwd 2>&1 | wc -l) | ||
146 | test ${N} -eq 0 || fail "local forward path still listening" | ||
147 | rm -f $OBJ/unix-1.fwd | ||
148 | |||
149 | verbose "test $tid: cmd forward remote (UNIX)" | ||
150 | ${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R $OBJ/unix-1.fwd:localhost:$PORT otherhost \ | ||
151 | || fail "request remote forward failed" | ||
152 | echo "" | nc -U $OBJ/unix-1.fwd | grep "Protocol mismatch" >/dev/null 2>&1 \ | ||
153 | || fail "connect to remote forwarded path failed" | ||
154 | ${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -R $OBJ/unix-1.fwd:localhost:$PORT otherhost \ | ||
155 | || fail "cancel remote forward failed" | ||
156 | N=$(echo "" | nc -U $OBJ/unix-1.fwd 2>&1 | wc -l) | ||
157 | test ${N} -eq 0 || fail "remote forward path still listening" | ||
158 | rm -f $OBJ/unix-1.fwd | ||
159 | |||
119 | verbose "test $tid: cmd exit" | 160 | verbose "test $tid: cmd exit" |
120 | ${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost >>$TEST_REGRESS_LOGFILE 2>&1 \ | 161 | ${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost >>$TEST_REGRESS_LOGFILE 2>&1 \ |
121 | || fail "send exit command failed" | 162 | || fail "send exit command failed" |