summaryrefslogtreecommitdiff
path: root/regress/forwarding.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regress/forwarding.sh')
-rw-r--r--regress/forwarding.sh28
1 files changed, 22 insertions, 6 deletions
diff --git a/regress/forwarding.sh b/regress/forwarding.sh
index f9c367beb..94873f22c 100644
--- a/regress/forwarding.sh
+++ b/regress/forwarding.sh
@@ -1,7 +1,8 @@
1# $OpenBSD: forwarding.sh,v 1.8 2012/06/01 00:47:35 djm Exp $ 1# $OpenBSD: forwarding.sh,v 1.11 2013/06/10 21:56:43 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"
5
5DATA=/bin/ls${EXEEXT} 6DATA=/bin/ls${EXEEXT}
6 7
7start_sshd 8start_sshd
@@ -26,9 +27,9 @@ for p in 1 2; do
26 27
27 trace "transfer over forwarded channels and check result" 28 trace "transfer over forwarded channels and check result"
28 ${SSH} -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \ 29 ${SSH} -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \
29 somehost cat $DATA > $OBJ/ls.copy 30 somehost cat ${DATA} > ${COPY}
30 test -f $OBJ/ls.copy || fail "failed copy $DATA" 31 test -f ${COPY} || fail "failed copy of ${DATA}"
31 cmp $DATA $OBJ/ls.copy || fail "corrupted copy of $DATA" 32 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
32 33
33 sleep 10 34 sleep 10
34done 35done
@@ -75,7 +76,7 @@ for p in 1 2; do
75 else 76 else
76 # this one should fail 77 # this one should fail
77 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 true \ 78 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 true \
78 2>>$TEST_SSH_LOGFILE && \ 79 >>$TEST_REGRESS_LOGFILE 2>&1 && \
79 fail "local forwarding not cleared" 80 fail "local forwarding not cleared"
80 fi 81 fi
81 sleep 10 82 sleep 10
@@ -88,7 +89,7 @@ for p in 1 2; do
88 else 89 else
89 # this one should fail 90 # this one should fail
90 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 true \ 91 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 true \
91 2>>$TEST_SSH_LOGFILE && \ 92 >>$TEST_REGRESS_LOGFILE 2>&1 && \
92 fail "remote forwarding not cleared" 93 fail "remote forwarding not cleared"
93 fi 94 fi
94 sleep 10 95 sleep 10
@@ -103,3 +104,18 @@ for p in 2; do
103 fail "stdio forwarding proto $p" 104 fail "stdio forwarding proto $p"
104 fi 105 fi
105done 106done
107
108echo "LocalForward ${base}01 127.0.0.1:$PORT" >> $OBJ/ssh_config
109echo "RemoteForward ${base}02 127.0.0.1:${base}01" >> $OBJ/ssh_config
110for p in 1 2; do
111 trace "config file: start forwarding, fork to background"
112 ${SSH} -$p -F $OBJ/ssh_config -f somehost sleep 10
113
114 trace "config file: transfer over forwarded channels and check result"
115 ${SSH} -F $OBJ/ssh_config -p${base}02 -o 'ConnectionAttempts=4' \
116 somehost cat ${DATA} > ${COPY}
117 test -f ${COPY} || fail "failed copy of ${DATA}"
118 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
119
120 wait
121done