summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/dynamic-forward.sh23
1 files changed, 20 insertions, 3 deletions
diff --git a/regress/dynamic-forward.sh b/regress/dynamic-forward.sh
index 4674a7baf..12ddef3a5 100644
--- a/regress/dynamic-forward.sh
+++ b/regress/dynamic-forward.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: dynamic-forward.sh,v 1.4 2004/06/22 22:55:56 dtucker Exp $ 1# $OpenBSD: dynamic-forward.sh,v 1.5 2011/05/20 05:19:50 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="dynamic forwarding" 4tid="dynamic forwarding"
@@ -21,8 +21,21 @@ start_sshd
21 21
22for p in 1 2; do 22for p in 1 2; do
23 trace "start dynamic forwarding, fork to background" 23 trace "start dynamic forwarding, fork to background"
24 ${SSH} -$p -F $OBJ/ssh_config -f -D $FWDPORT -q somehost \ 24 rm -f $OBJ/remote_pid
25 exec sh -c \'"echo \$\$ > $OBJ/remote_pid; exec sleep 444"\' 25 ${SSH} -$p -F $OBJ/ssh_config -D $FWDPORT -q somehost \
26 exec sh -c \'"echo \$\$ > $OBJ/remote_pid; exec sleep 444"\' &
27 client_pid=$!
28
29 # Wait for ssh to start
30 n=0
31 while test ! -f $OBJ/remote_pid; do
32 sleep 1
33 n=`expr $n + 1`
34 if test $n > 60; then
35 kill $client_pid
36 fail "Timed out waiting for client to connect"
37 fi
38 done
26 39
27 for s in 4 5; do 40 for s in 4 5; do
28 for h in 127.0.0.1 localhost; do 41 for h in 127.0.0.1 localhost; do
@@ -41,10 +54,14 @@ for p in 1 2; do
41 if [ $remote -gt 1 ]; then 54 if [ $remote -gt 1 ]; then
42 kill -HUP $remote 55 kill -HUP $remote
43 fi 56 fi
57 rm -f $OBJ/remote_pid
44 else 58 else
45 fail "no pid file: $OBJ/remote_pid" 59 fail "no pid file: $OBJ/remote_pid"
46 fi 60 fi
47 61
62 # Wait for listening ssh to terminate
63 wait
64
48 # Must allow time for connection tear-down 65 # Must allow time for connection tear-down
49 sleep 2 66 sleep 2
50done 67done