]> andersk Git - openssh.git/blob - regress/dynamic-forward.sh
- (dtucker) [regress/dynamic-forward.sh] Import new regression test.
[openssh.git] / regress / dynamic-forward.sh
1 #       $OpenBSD: dynamic-forward.sh,v 1.1 2003/06/26 14:23:10 markus Exp $
2 #       Placed in the Public Domain.
3
4 tid="dynamic forwarding"
5
6 PORT=4242
7 FWDPORT=4243
8
9 if [ -x `which nc` ] && nc -h 2>&1 | grep "x proxy address" >/dev/null; then
10         proxycmd="nc -x 127.0.0.1:$FWDPORT -X"
11 elif [ -x `which connect` ]; then
12         proxycmd="connect -S 127.0.0.1:$FWDPORT -"
13 else
14         echo "skipped (no suitable ProxyCommand found)"
15         exit 0
16 fi
17 trace "will use ProxyCommand $proxycmd"
18
19 start_sshd
20
21 for p in 1 2; do
22   for s in 4; do
23     for h in 127.0.0.1 localhost; do
24         trace "testing ssh protocol $p socks version $s host $h"
25         trace "start dynamic forwarding, fork to background"
26         ${SSH} -$p -F $OBJ/ssh_config -f -D $FWDPORT somehost sleep 10
27
28         trace "transfer over forwarded channel and check result"
29         ${SSH} -F $OBJ/ssh_config -o "ProxyCommand ${proxycmd}${s} $h $PORT" \
30                 somehost cat /bin/ls > $OBJ/ls.copy
31         test -f $OBJ/ls.copy     || fail "failed copy /bin/ls"
32         cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls"
33
34         sleep 10
35     done
36   done
37 done
This page took 0.409214 seconds and 5 git commands to generate.