summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile61
-rw-r--r--regress/README.regress86
-rw-r--r--regress/agent-getpeereid.sh6
-rw-r--r--regress/agent-ptrace.sh18
-rw-r--r--regress/agent-timeout.sh12
-rw-r--r--regress/agent.sh2
-rw-r--r--regress/dynamic-forward.sh47
-rw-r--r--regress/forwarding.sh7
-rw-r--r--regress/proto-version.sh2
-rw-r--r--regress/reconfigure.sh35
-rw-r--r--regress/rekey.sh31
-rw-r--r--regress/sftp-badcmds.sh78
-rw-r--r--regress/sftp-batch.sh4
-rw-r--r--regress/sftp-cmds.sh109
-rw-r--r--regress/sftp.sh26
-rw-r--r--regress/ssh-com-client.sh6
-rw-r--r--regress/ssh-com-keygen.sh4
-rw-r--r--regress/ssh-com-sftp.sh28
-rw-r--r--regress/ssh-com.sh6
-rw-r--r--regress/stderr-after-eof.sh14
-rw-r--r--regress/stderr-data.sh2
-rw-r--r--regress/test-exec.sh45
-rw-r--r--regress/transfer.sh2
-rw-r--r--regress/try-ciphers.sh5
-rw-r--r--regress/yes-head.sh2
25 files changed, 552 insertions, 86 deletions
diff --git a/regress/Makefile b/regress/Makefile
index 6e2029348..623be8d82 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,8 +1,11 @@
1# $OpenBSD: Makefile,v 1.20 2003/01/08 23:54:22 djm Exp $ 1# $OpenBSD: Makefile,v 1.24 2003/07/03 08:24:13 markus Exp $
2 2
3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec
4tests: $(REGRESS_TARGETS)
4 5
5CLEANFILES+= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 6clean:
7 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
8distclean: clean
6 9
7LTESTS= connect \ 10LTESTS= connect \
8 proxy-connect \ 11 proxy-connect \
@@ -11,6 +14,7 @@ LTESTS= connect \
11 proto-mismatch \ 14 proto-mismatch \
12 exit-status \ 15 exit-status \
13 transfer \ 16 transfer \
17 rekey \
14 stderr-data \ 18 stderr-data \
15 stderr-after-eof \ 19 stderr-after-eof \
16 broken-pipe \ 20 broken-pipe \
@@ -24,30 +28,34 @@ LTESTS= connect \
24 keygen-change \ 28 keygen-change \
25 sftp \ 29 sftp \
26 sftp-cmds \ 30 sftp-cmds \
31 sftp-badcmds \
27 sftp-batch \ 32 sftp-batch \
33 reconfigure \
34 dynamic-forward \
28 forwarding 35 forwarding
29 36
30USER!= id -un 37USER!= id -un
31CLEANFILES+= authorized_keys_${USER} known_hosts pidfile \ 38CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
39 authorized_keys_${USER} known_hosts pidfile \
32 ssh_config ssh_proxy sshd_config sshd_proxy \ 40 ssh_config ssh_proxy sshd_config sshd_proxy \
33 rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \ 41 rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
34 rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \ 42 rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
35 ls.copy 43 ls.copy remote_pid
36 44
37#LTESTS+= ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp 45#LTESTS += ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
38 46
39t1: 47t1:
40 ssh-keygen -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv 48 ssh-keygen -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
41 49
42t2: 50t2:
43 cat ${.CURDIR}/rsa_openssh.prv > t2.out 51 cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out
44 chmod 600 t2.out 52 chmod 600 $(OBJ)/t2.out
45 ssh-keygen -yf t2.out | diff - ${.CURDIR}/rsa_openssh.pub 53 ssh-keygen -yf $(OBJ)/t2.out | diff - ${.CURDIR}/rsa_openssh.pub
46 54
47t3: 55t3:
48 ssh-keygen -ef ${.CURDIR}/rsa_openssh.pub |\ 56 ssh-keygen -ef ${.CURDIR}/rsa_openssh.pub >$(OBJ)/rsa_secsh.pub
49 ssh-keygen -if /dev/stdin |\ 57 ssh-keygen -if $(OBJ)/rsa_secsh.pub | diff - ${.CURDIR}/rsa_openssh.pub
50 diff - ${.CURDIR}/rsa_openssh.pub 58 rm -f ${.CURDIR}/rsa_secsh.pub
51 59
52t4: 60t4:
53 ssh-keygen -lf ${.CURDIR}/rsa_openssh.pub |\ 61 ssh-keygen -lf ${.CURDIR}/rsa_openssh.pub |\
@@ -58,22 +66,21 @@ t5:
58 awk '{print $$2}' | diff - ${.CURDIR}/t5.ok 66 awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
59 67
60t6: 68t6:
61 ssh-keygen -if ${.CURDIR}/dsa_ssh2.prv > t6.out1 69 ssh-keygen -if ${.CURDIR}/dsa_ssh2.prv > $(OBJ)/t6.out1
62 ssh-keygen -if ${.CURDIR}/dsa_ssh2.pub > t6.out2 70 ssh-keygen -if ${.CURDIR}/dsa_ssh2.pub > $(OBJ)/t6.out2
63 chmod 600 t6.out1 71 chmod 600 $(OBJ)/t6.out1
64 ssh-keygen -yf t6.out1 | diff - t6.out2 72 ssh-keygen -yf $(OBJ)/t6.out1 | diff - $(OBJ)/t6.out2
65 73
66t7.out: 74$(OBJ)/t7.out:
67 ssh-keygen -q -t rsa -N '' -f $@ 75 ssh-keygen -q -t rsa -N '' -f $@
68 76
69t7: t7.out 77t7: $(OBJ)/t7.out
70 ssh-keygen -lf t7.out > /dev/null 78 ssh-keygen -lf $(OBJ)/t7.out > /dev/null
71 ssh-keygen -Bf t7.out > /dev/null 79 ssh-keygen -Bf $(OBJ)/t7.out > /dev/null
72 80
73.for t in ${LTESTS} 81t-exec: ${LTESTS:=.sh}
74REGRESS_TARGETS+=t-${t} 82 @if [ "x$?" = "x" ]; then exit 0; fi; \
75t-${t}: 83 for TEST in ""$?; do \
76 sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/${t}.sh 84 echo "run test $${TEST}" ... 1>&2; \
77.endfor 85 (sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
78 86 done
79.include "bsd.regress.mk"
diff --git a/regress/README.regress b/regress/README.regress
new file mode 100644
index 000000000..916894a88
--- /dev/null
+++ b/regress/README.regress
@@ -0,0 +1,86 @@
1Overview.
2
3$ ./configure && make tests
4
5You'll see some progress info. A failure will cause either the make to
6abort or the driver script to report a "FATAL" failure.
7
8The test consists of 2 parts. The first is the file-based tests which is
9driven by the Makefile, and the second is a set of network or proxycommand
10based tests, which are driven by a driver script (test-exec.sh) which is
11called multiple times by the Makefile.
12
13Failures in the first part will cause the Makefile to return an error.
14Failures in the second part will print a "FATAL" message for the failed
15test and continue.
16
17OpenBSD has a system-wide regression test suite. OpenSSH Portable's test
18suite is based on OpenBSD's with modifications.
19
20
21Environment variables.
22
23SUDO: path to sudo command, if desired. Note that some systems (notably
24 systems using PAM) require sudo to execute some tests.
25TEST_SSH_TRACE: set yo "yes" for verbose output from tests
26TEST_SSH_QUIET: set to "yes" to suppress non-fatal output.
27TEST_SSH_x: path to "ssh" command under test, where x=SSH,SSHD,SSHAGENT,SSHADD
28 SSHKEYGEN,SSHKEYSCAN,SFTP,SFTPSERVER
29OBJ: used by test scripts to access build dir.
30
31
32Individual tests.
33
34You can invoke test-exec.sh directly if you set up the path to find the
35binaries under test and the test scripts themselves, for example:
36
37$ cd regress
38$ PATH=`pwd`/..:$PATH:. sh test-exec.sh `pwd` agent-timeout.sh
39ok agent timeout test
40
41
42Files.
43
44test-exec.sh: the main test driver. Sets environment, creates config files
45and keys and runs the specified test.
46
47At the time of writing, the individual tests are:
48agent-timeout.sh: agent timeout test
49agent.sh: simple agent test
50broken-pipe.sh: broken pipe test
51connect-privsep.sh: proxy connect with privsep
52connect.sh: simple connect
53exit-status.sh: remote exit status
54forwarding.sh: local and remote forwarding
55keygen-change.sh: change passphrase for key
56keyscan.sh: keyscan
57proto-mismatch.sh: protocol version mismatch
58proto-version.sh: sshd version with different protocol combinations
59proxy-connect.sh: proxy connect
60sftp.sh: basic sftp put/get
61ssh-com-client.sh: connect with ssh.com client
62ssh-com-keygen.sh: ssh.com key import
63ssh-com-sftp.sh: basic sftp put/get with ssh.com server
64ssh-com.sh: connect to ssh.com server
65stderr-after-eof.sh: stderr data after eof
66stderr-data.sh: stderr data transfer
67transfer.sh: transfer data
68try-ciphers.sh: try ciphers
69yes-head.sh: yes pipe head
70
71
72Problems?
73
74Run the failing test with shell tracing (-x) turned on:
75$ PATH=`pwd`/..:$PATH:. sh -x test-exec.sh `pwd` agent-timeout.sh
76
77Failed tests can be difficult to diagnose. Suggestions:
78- run the individual test via ./test-exec.sh `pwd` [testname]
79- set LogLevel to VERBOSE in test-exec.sh and enable syslogging of
80 auth.debug (eg to /var/log/authlog).
81
82
83Known Issues.
84
85
86$Id: README.regress,v 1.1 2003/09/04 05:39:54 dtucker Exp $
diff --git a/regress/agent-getpeereid.sh b/regress/agent-getpeereid.sh
index 0889fe80e..46d20dc2b 100644
--- a/regress/agent-getpeereid.sh
+++ b/regress/agent-getpeereid.sh
@@ -7,6 +7,12 @@ UNPRIV=nobody
7ASOCK=${OBJ}/agent 7ASOCK=${OBJ}/agent
8SSH_AUTH_SOCK=/nonexistant 8SSH_AUTH_SOCK=/nonexistant
9 9
10if grep "#undef.*HAVE_GETPEEREID" ${BUILDDIR}/config.h >/dev/null 2>&1
11then
12 echo "skipped (not supported on this platform)"
13 exit 0
14fi
15
10trace "start agent" 16trace "start agent"
11eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null 17eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null
12r=$? 18r=$?
diff --git a/regress/agent-ptrace.sh b/regress/agent-ptrace.sh
index 9f9c99960..cd9c0023d 100644
--- a/regress/agent-ptrace.sh
+++ b/regress/agent-ptrace.sh
@@ -3,6 +3,22 @@
3 3
4tid="disallow agent ptrace attach" 4tid="disallow agent ptrace attach"
5 5
6if have_prog uname ; then
7 case `uname` in
8 Linux|HP-UX|SunOS|NetBSD|AIX|CYGWIN*)
9 echo "skipped (not supported on this platform)"
10 exit 0
11 ;;
12 esac
13fi
14
15if have_prog gdb ; then
16 : ok
17else
18 echo "skipped (gdb not found)"
19 exit 0
20fi
21
6trace "start agent" 22trace "start agent"
7eval `${SSHAGENT} -s` > /dev/null 23eval `${SSHAGENT} -s` > /dev/null
8r=$? 24r=$?
@@ -16,7 +32,7 @@ EOF
16 if [ $? -ne 0 ]; then 32 if [ $? -ne 0 ]; then
17 fail "gdb failed: exit code $?" 33 fail "gdb failed: exit code $?"
18 fi 34 fi
19 grep -q 'ptrace: Operation not permitted.' ${OBJ}/gdb.out 35 grep 'ptrace: Operation not permitted.' >/dev/null ${OBJ}/gdb.out
20 r=$? 36 r=$?
21 rm -f ${OBJ}/gdb.out 37 rm -f ${OBJ}/gdb.out
22 if [ $r -ne 0 ]; then 38 if [ $r -ne 0 ]; then
diff --git a/regress/agent-timeout.sh b/regress/agent-timeout.sh
index 28b1be028..3a40e7af8 100644
--- a/regress/agent-timeout.sh
+++ b/regress/agent-timeout.sh
@@ -3,7 +3,7 @@
3 3
4tid="agent timeout test" 4tid="agent timeout test"
5 5
6TIMEOUT=5 6SSHAGENT_TIMEOUT=10
7 7
8trace "start agent" 8trace "start agent"
9eval `${SSHAGENT} -s` > /dev/null 9eval `${SSHAGENT} -s` > /dev/null
@@ -13,7 +13,7 @@ if [ $r -ne 0 ]; then
13else 13else
14 trace "add keys with timeout" 14 trace "add keys with timeout"
15 for t in rsa rsa1; do 15 for t in rsa rsa1; do
16 ${SSHADD} -t ${TIMEOUT} $OBJ/$t > /dev/null 2>&1 16 ${SSHADD} -t ${SSHAGENT_TIMEOUT} $OBJ/$t > /dev/null 2>&1
17 if [ $? -ne 0 ]; then 17 if [ $? -ne 0 ]; then
18 fail "ssh-add did succeed exit code 0" 18 fail "ssh-add did succeed exit code 0"
19 fi 19 fi
@@ -23,10 +23,10 @@ else
23 if [ $n -ne 2 ]; then 23 if [ $n -ne 2 ]; then
24 fail "ssh-add -l did not return 2 keys: $n" 24 fail "ssh-add -l did not return 2 keys: $n"
25 fi 25 fi
26 trace "sleeping 2*${TIMEOUT} seconds" 26 trace "sleeping 2*${SSHAGENT_TIMEOUT} seconds"
27 sleep ${TIMEOUT} 27 sleep ${SSHAGENT_TIMEOUT}
28 sleep ${TIMEOUT} 28 sleep ${SSHAGENT_TIMEOUT}
29 ${SSHADD} -l 2> /dev/null | grep -q 'The agent has no identities.' 29 ${SSHADD} -l 2> /dev/null | grep 'The agent has no identities.' >/dev/null
30 if [ $? -ne 0 ]; then 30 if [ $? -ne 0 ]; then
31 fail "ssh-add -l still returns keys after timeout" 31 fail "ssh-add -l still returns keys after timeout"
32 fi 32 fi
diff --git a/regress/agent.sh b/regress/agent.sh
index 7e9b4cb18..b34487767 100644
--- a/regress/agent.sh
+++ b/regress/agent.sh
@@ -19,7 +19,7 @@ else
19 fail "ssh-add -l did not fail with exit code 1" 19 fail "ssh-add -l did not fail with exit code 1"
20 fi 20 fi
21 trace "overwrite authorized keys" 21 trace "overwrite authorized keys"
22 echo -n > $OBJ/authorized_keys_$USER 22 echon > $OBJ/authorized_keys_$USER
23 for t in rsa rsa1; do 23 for t in rsa rsa1; do
24 # generate user key for agent 24 # generate user key for agent
25 rm -f $OBJ/$t-agent 25 rm -f $OBJ/$t-agent
diff --git a/regress/dynamic-forward.sh b/regress/dynamic-forward.sh
new file mode 100644
index 000000000..2b0b825d0
--- /dev/null
+++ b/regress/dynamic-forward.sh
@@ -0,0 +1,47 @@
1# $OpenBSD: dynamic-forward.sh,v 1.2 2003/07/03 08:21:46 markus Exp $
2# Placed in the Public Domain.
3
4tid="dynamic forwarding"
5
6PORT=4242
7FWDPORT=4243
8DATA=/bin/ls${EXEEXT}
9
10if have_prog nc && nc -h 2>&1 | grep "x proxy address" >/dev/null; then
11 proxycmd="nc -x 127.0.0.1:$FWDPORT -X"
12elif have_prog connect; then
13 proxycmd="connect -S 127.0.0.1:$FWDPORT -"
14else
15 echo "skipped (no suitable ProxyCommand found)"
16 exit 0
17fi
18trace "will use ProxyCommand $proxycmd"
19
20start_sshd
21
22for p in 1 2; do
23 trace "start dynamic forwarding, fork to background"
24 ${SSH} -$p -F $OBJ/ssh_config -f -D $FWDPORT -q somehost \
25 exec sh -c \'"echo \$\$ > $OBJ/remote_pid; exec sleep 444"\'
26
27 for s in 4 5; do
28 for h in 127.0.0.1 localhost; do
29 trace "testing ssh protocol $p socks version $s host $h"
30 ${SSH} -F $OBJ/ssh_config \
31 -o "ProxyCommand ${proxycmd}${s} $h $PORT" \
32 somehost cat $DATA > $OBJ/ls.copy
33 test -f $OBJ/ls.copy || fail "failed copy $DATA"
34 cmp $DATA $OBJ/ls.copy || fail "corrupted copy of $DATA"
35 done
36 done
37
38 if [ -f $OBJ/remote_pid ]; then
39 remote=`cat $OBJ/remote_pid`
40 trace "terminate remote shell, pid $remote"
41 if [ $remote -gt 1 ]; then
42 kill -HUP $remote
43 fi
44 else
45 fail "no pid file: $OBJ/remote_pid"
46 fi
47done
diff --git a/regress/forwarding.sh b/regress/forwarding.sh
index 7b281c013..dfe065dd6 100644
--- a/regress/forwarding.sh
+++ b/regress/forwarding.sh
@@ -2,6 +2,7 @@
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="local and remote forwarding" 4tid="local and remote forwarding"
5DATA=/bin/ls${EXEEXT}
5 6
6start_sshd 7start_sshd
7 8
@@ -25,9 +26,9 @@ for p in 1 2; do
25 26
26 trace "transfer over forwarded channels and check result" 27 trace "transfer over forwarded channels and check result"
27 ${SSH} -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \ 28 ${SSH} -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \
28 somehost cat /bin/ls > $OBJ/ls.copy 29 somehost cat $DATA > $OBJ/ls.copy
29 test -f $OBJ/ls.copy || fail "failed copy /bin/ls" 30 test -f $OBJ/ls.copy || fail "failed copy $DATA"
30 cmp /bin/ls $OBJ/ls.copy || fail "corrupted copy of /bin/ls" 31 cmp $DATA $OBJ/ls.copy || fail "corrupted copy of $DATA"
31 32
32 sleep 10 33 sleep 10
33done 34done
diff --git a/regress/proto-version.sh b/regress/proto-version.sh
index 7dc616f5f..1651a69e1 100644
--- a/regress/proto-version.sh
+++ b/regress/proto-version.sh
@@ -8,7 +8,7 @@ check_version ()
8{ 8{
9 version=$1 9 version=$1
10 expect=$2 10 expect=$2
11 banner=`echo -n | ${SSHD} -o "Protocol=${version}" -i -f ${OBJ}/sshd_proxy` 11 banner=`echon | ${SSHD} -o "Protocol=${version}" -i -f ${OBJ}/sshd_proxy`
12 case ${banner} in 12 case ${banner} in
13 SSH-1.99-*) 13 SSH-1.99-*)
14 proto=199 14 proto=199
diff --git a/regress/reconfigure.sh b/regress/reconfigure.sh
new file mode 100644
index 000000000..ba6dbc6f5
--- /dev/null
+++ b/regress/reconfigure.sh
@@ -0,0 +1,35 @@
1# $OpenBSD: reconfigure.sh,v 1.2 2003/06/21 09:14:05 markus Exp $
2# Placed in the Public Domain.
3
4tid="simple connect after reconfigure"
5
6# we need the full path to sshd for -HUP
7case $SSHD in
8/*)
9 # full path is OK
10 ;;
11*)
12 # otherwise make fully qualified
13 SSHD=$OBJ/$SSHD
14esac
15
16start_sshd
17
18$SUDO kill -HUP `cat $PIDFILE`
19sleep 1
20
21trace "wait for sshd to restart"
22i=0;
23while [ ! -f $PIDFILE -a $i -lt 10 ]; do
24 i=`expr $i + 1`
25 sleep $i
26done
27
28test -f $PIDFILE || fatal "sshd did not restart"
29
30for p in 1 2; do
31 ${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true
32 if [ $? -ne 0 ]; then
33 fail "ssh connect with protocol $p failed after reconfigure"
34 fi
35done
diff --git a/regress/rekey.sh b/regress/rekey.sh
new file mode 100644
index 000000000..6b7e845ec
--- /dev/null
+++ b/regress/rekey.sh
@@ -0,0 +1,31 @@
1# $OpenBSD: rekey.sh,v 1.1 2003/03/28 13:58:28 markus Exp $
2# Placed in the Public Domain.
3
4tid="rekey during transfer data"
5
6DATA=${OBJ}/data
7COPY=${OBJ}/copy
8LOG=${OBJ}/log
9
10rm -f ${COPY} ${LOG} ${DATA}
11dd if=/bin/ls${EXEEXT} of=${DATA} bs=1k seek=511 count=1 > /dev/null 2>&1
12
13for s in 16 1k 128k 256k; do
14 trace "rekeylimit ${s}"
15 rm -f ${COPY}
16 cat $DATA | \
17 ${SSH} -oCompression=no -oRekeyLimit=$s \
18 -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" \
19 2> ${LOG}
20 if [ $? -ne 0 ]; then
21 fail "ssh failed"
22 fi
23 cmp $DATA ${COPY} || fail "corrupted copy"
24 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
25 n=`expr $n - 1`
26 trace "$n rekeying(s)"
27 if [ $n -lt 1 ]; then
28 fail "no rekeying occured"
29 fi
30done
31rm -f ${COPY} ${LOG} ${DATA}
diff --git a/regress/sftp-badcmds.sh b/regress/sftp-badcmds.sh
new file mode 100644
index 000000000..a6a19409d
--- /dev/null
+++ b/regress/sftp-badcmds.sh
@@ -0,0 +1,78 @@
1# $OpenBSD: sftp-badcmds.sh,v 1.2 2003/05/15 04:07:12 mouring Exp $
2# Placed in the Public Domain.
3
4tid="sftp invalid commands"
5
6DATA=/bin/ls${EXEEXT}
7DATA2=/bin/cat${EXEEXT}
8NONEXIST=/NONEXIST.$$
9COPY=${OBJ}/copy
10GLOBFILES=`(cd /bin;echo l*)`
11
12rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd
13
14rm -f ${COPY}
15verbose "$tid: get nonexistent"
16echo "get $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
17 || fail "get nonexistent failed"
18test -f ${COPY} && fail "existing copy after get nonexistent"
19
20rm -f ${COPY}.dd/*
21verbose "$tid: glob get to nonexistent directory"
22echo "get /bin/l* $NONEXIST" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
23 || fail "get nonexistent failed"
24for x in $GLOBFILES; do
25 test -f ${COPY}.dd/$x && fail "existing copy after get nonexistent"
26done
27
28rm -f ${COPY}
29verbose "$tid: put nonexistent"
30echo "put $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
31 || fail "put nonexistent failed"
32test -f ${COPY} && fail "existing copy after put nonexistent"
33
34rm -f ${COPY}.dd/*
35verbose "$tid: glob put to nonexistent directory"
36echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
37 || fail "put nonexistent failed"
38for x in $GLOBFILES; do
39 test -f ${COPY}.dd/$x && fail "existing copy after nonexistent"
40done
41
42rm -f ${COPY}
43verbose "$tid: rename nonexistent"
44echo "rename $NONEXIST ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
45 || fail "rename nonexist failed"
46test -f ${COPY}.1 && fail "file exists after rename nonexistent"
47
48rm -f ${COPY} ${COPY}.1
49cp $DATA $COPY
50cp $DATA2 ${COPY}.1
51verbose "$tid: rename target exists"
52echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
53 || fail "rename target exists failed"
54test -f ${COPY} || fail "oldname missing after rename target exists"
55test -f ${COPY}.1 || fail "newname missing after rename target exists"
56cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists"
57cmp $DATA2 ${COPY}.1 >/dev/null 2>&1 || fail "corrupted newname after rename target exists"
58
59rm -rf ${COPY} ${COPY}.dd
60cp $DATA $COPY
61mkdir ${COPY}.dd
62verbose "$tid: rename target exists (directory)"
63echo "rename $COPY ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
64 || fail "rename target exists (directory) failed"
65test -f ${COPY} || fail "oldname missing after rename target exists (directory)"
66test -d ${COPY}.dd || fail "newname missing after rename target exists (directory)"
67cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists (directory)"
68
69rm -f ${COPY}.dd/*
70rm -rf ${COPY}
71cp ${DATA2} ${COPY}
72verbose "$tid: glob put files to local file"
73echo "put /bin/l* $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1
74cmp ${DATA2} ${COPY} || fail "put successed when it should have failed"
75
76rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd
77
78
diff --git a/regress/sftp-batch.sh b/regress/sftp-batch.sh
index cffacb6df..f648eae80 100644
--- a/regress/sftp-batch.sh
+++ b/regress/sftp-batch.sh
@@ -3,9 +3,9 @@
3 3
4tid="sftp batchfile" 4tid="sftp batchfile"
5 5
6DATA=/bin/ls 6DATA=/bin/ls${EXEEXT}
7COPY=${OBJ}/copy 7COPY=${OBJ}/copy
8BATCH=${OBJ}/sftp-batch 8BATCH=${OBJ}/sftp-batch.tmp
9 9
10rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* 10rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
11 11
diff --git a/regress/sftp-cmds.sh b/regress/sftp-cmds.sh
index 462c6802f..1256aeb2d 100644
--- a/regress/sftp-cmds.sh
+++ b/regress/sftp-cmds.sh
@@ -1,17 +1,42 @@
1# $OpenBSD: sftp-cmds.sh,v 1.2 2003/01/10 07:52:41 djm Exp $ 1# $OpenBSD: sftp-cmds.sh,v 1.5 2003/07/19 00:46:31 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4# XXX - TODO: 4# XXX - TODO:
5# - globbed operations
6# - chmod / chown / chgrp 5# - chmod / chown / chgrp
7# - -p flag for get & put 6# - -p flag for get & put
8 7
9tid="sftp commands" 8tid="sftp commands"
10 9
11DATA=/bin/ls 10DATA=/bin/ls${EXEEXT}
12COPY=${OBJ}/copy 11COPY=${OBJ}/copy
13 12# test that these files are readable!
14rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* 13for i in `(cd /bin;echo l*)`
14do
15 if [ -r $i ]; then
16 GLOBFILES="$GLOBFILES $i"
17 fi
18done
19
20if have_prog uname
21then
22 case `uname` in
23 CYGWIN*)
24 os=cygwin
25 ;;
26 *)
27 os=`uname`
28 ;;
29 esac
30else
31 os="unknown"
32fi
33
34# Path with embedded quote
35QUOTECOPY=${COPY}".\"blah\""
36QUOTECOPY_ARG=${COPY}'.\"blah\"'
37
38rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2
39mkdir ${COPY}.dd
15 40
16verbose "$tid: lls" 41verbose "$tid: lls"
17echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 42echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
@@ -54,21 +79,91 @@ echo "get $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
54 || fail "get failed" 79 || fail "get failed"
55cmp $DATA ${COPY} || fail "corrupted copy after get" 80cmp $DATA ${COPY} || fail "corrupted copy after get"
56 81
82rm -f ${COPY}.dd/*
83verbose "$tid: get to directory"
84echo "get $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
85 || fail "get failed"
86cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get"
87
88rm -f ${COPY}.dd/*
89verbose "$tid: glob get to directory"
90echo "get /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
91 || fail "get failed"
92for x in $GLOBFILES; do
93 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get"
94done
95
96rm -f ${COPY}.dd/*
97verbose "$tid: get to local dir"
98(echo "lcd ${COPY}.dd"; echo "get $DATA" ) | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
99 || fail "get failed"
100cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get"
101
102rm -f ${COPY}.dd/*
103verbose "$tid: glob get to local dir"
104(echo "lcd ${COPY}.dd"; echo "get /bin/l*") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
105 || fail "get failed"
106for x in $GLOBFILES; do
107 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get"
108done
109
57rm -f ${COPY} 110rm -f ${COPY}
58verbose "$tid: put" 111verbose "$tid: put"
59echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 112echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
60 || fail "put failed" 113 || fail "put failed"
61cmp $DATA ${COPY} || fail "corrupted copy after put" 114cmp $DATA ${COPY} || fail "corrupted copy after put"
62 115
116if [ "$os" != "cygwin" ]; then
117rm -f ${QUOTECOPY}
118verbose "$tid: put filename with quotes"
119echo "put $DATA \"$QUOTECOPY_ARG\"" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
120 || fail "put failed"
121cmp $DATA ${QUOTECOPY} || fail "corrupted copy after put with quotes"
122fi
123
124rm -f ${COPY}.dd/*
125verbose "$tid: put to directory"
126echo "put $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
127 || fail "put failed"
128cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put"
129
130rm -f ${COPY}.dd/*
131verbose "$tid: glob put to directory"
132echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
133 || fail "put failed"
134for x in $GLOBFILES; do
135 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put"
136done
137
138rm -f ${COPY}.dd/*
139verbose "$tid: put to local dir"
140(echo "cd ${COPY}.dd"; echo "put $DATA") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
141 || fail "put failed"
142cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put"
143
144rm -f ${COPY}.dd/*
145verbose "$tid: glob put to local dir"
146(echo "cd ${COPY}.dd"; echo "put /bin/l*") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
147 || fail "put failed"
148for x in $GLOBFILES; do
149 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put"
150done
151
63verbose "$tid: rename" 152verbose "$tid: rename"
64echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 153echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
65 || fail "rename failed" 154 || fail "rename failed"
66test -f ${COPY}.1 || fail "missing file after rename" 155test -f ${COPY}.1 || fail "missing file after rename"
67cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" 156cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename"
68 157
158verbose "$tid: rename directory"
159echo "rename ${COPY}.dd ${COPY}.dd2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
160 || fail "rename directory failed"
161test -d ${COPY}.dd && fail "oldname exists after rename directory"
162test -d ${COPY}.dd2 || fail "missing newname after rename directory"
163
69verbose "$tid: ln" 164verbose "$tid: ln"
70echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed" 165echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed"
71test -L ${COPY}.2 || fail "missing file after ln" 166test -h ${COPY}.2 || fail "missing file after ln"
72 167
73verbose "$tid: mkdir" 168verbose "$tid: mkdir"
74echo "mkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 169echo "mkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
@@ -95,6 +190,6 @@ verbose "$tid: lchdir"
95echo "lchdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 190echo "lchdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
96 || fail "lchdir failed" 191 || fail "lchdir failed"
97 192
98rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* 193rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2
99 194
100 195
diff --git a/regress/sftp.sh b/regress/sftp.sh
index e8d473123..0e22f8f6b 100644
--- a/regress/sftp.sh
+++ b/regress/sftp.sh
@@ -3,27 +3,33 @@
3 3
4tid="basic sftp put/get" 4tid="basic sftp put/get"
5 5
6DATA=/bin/ls 6DATA=/bin/ls${EXEEXT}
7COPY=${OBJ}/copy 7COPY=${OBJ}/copy
8 8
9SFTPCMDFILE=${OBJ}/batch
10cat >$SFTPCMDFILE <<EOF
11version
12get $DATA ${COPY}.1
13put $DATA ${COPY}.2
14EOF
15
9BUFFERSIZE="5 1000 32000 64000" 16BUFFERSIZE="5 1000 32000 64000"
10REQUESTS="1 2 10" 17REQUESTS="1 2 10"
11 18
12for B in ${BUFFERSIZE}; do 19for B in ${BUFFERSIZE}; do
13 for R in ${REQUESTS}; do 20 for R in ${REQUESTS}; do
14 verbose "test $tid: buffer_size $B num_requests $R" 21 verbose "test $tid: buffer_size $B num_requests $R"
15 rm -f ${COPY}.1 ${COPY}.2 22 rm -f ${COPY}.1 ${COPY}.2
16 ${SFTP} -P ${SFTPSERVER} -B $B -R $R -b /dev/stdin \ 23 ${SFTP} -P ${SFTPSERVER} -B $B -R $R -b $SFTPCMDFILE \
17 > /dev/null 2>&1 << EOF 24 > /dev/null 2>&1
18 version
19 get $DATA ${COPY}.1
20 put $DATA ${COPY}.2
21EOF
22 r=$? 25 r=$?
23 if [ $r -ne 0 ]; then 26 if [ $r -ne 0 ]; then
24 fail "sftp failed with $r" 27 fail "sftp failed with $r"
28 else
29 cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
30 cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
25 fi 31 fi
26 cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
27 cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
28 done 32 done
29done 33done
34rm -f ${COPY}.1 ${COPY}.2
35rm -f $SFTPCMDFILE
diff --git a/regress/ssh-com-client.sh b/regress/ssh-com-client.sh
index 015ebbb8c..fc953228e 100644
--- a/regress/ssh-com-client.sh
+++ b/regress/ssh-com-client.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: ssh-com-client.sh,v 1.4 2002/07/16 08:58:16 markus Exp $ 1# $OpenBSD: ssh-com-client.sh,v 1.5 2003/05/14 22:08:27 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="connect with ssh.com client" 4tid="connect with ssh.com client"
@@ -17,6 +17,8 @@ VERSIONS="
17 3.0.0 17 3.0.0
18 3.1.0 18 3.1.0
19 3.2.0 19 3.2.0
20 3.2.2
21 3.2.3
20 3.3.0" 22 3.3.0"
21 23
22# 2.0.10 2.0.12 2.0.13 don't like the test setup 24# 2.0.10 2.0.12 2.0.13 don't like the test setup
@@ -62,7 +64,7 @@ EOF
62# we need a real server (no ProxyConnect option) 64# we need a real server (no ProxyConnect option)
63start_sshd 65start_sshd
64 66
65DATA=/bin/ls 67DATA=/bin/ls${EXEEXT}
66COPY=${OBJ}/copy 68COPY=${OBJ}/copy
67rm -f ${COPY} 69rm -f ${COPY}
68 70
diff --git a/regress/ssh-com-keygen.sh b/regress/ssh-com-keygen.sh
index e93dc78c9..dbe9b0a6b 100644
--- a/regress/ssh-com-keygen.sh
+++ b/regress/ssh-com-keygen.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: ssh-com-keygen.sh,v 1.2 2002/07/16 08:58:16 markus Exp $ 1# $OpenBSD: ssh-com-keygen.sh,v 1.3 2003/05/14 22:08:27 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="ssh.com key import" 4tid="ssh.com key import"
@@ -20,6 +20,8 @@ VERSIONS="
20 3.0.0 20 3.0.0
21 3.1.0 21 3.1.0
22 3.2.0 22 3.2.0
23 3.2.2
24 3.2.3
23 3.3.0" 25 3.3.0"
24 26
25COMPRV=${OBJ}/comkey 27COMPRV=${OBJ}/comkey
diff --git a/regress/ssh-com-sftp.sh b/regress/ssh-com-sftp.sh
index f08018b84..6ca7dad51 100644
--- a/regress/ssh-com-sftp.sh
+++ b/regress/ssh-com-sftp.sh
@@ -1,10 +1,17 @@
1# $OpenBSD: ssh-com-sftp.sh,v 1.3 2002/07/16 08:58:16 markus Exp $ 1# $OpenBSD: ssh-com-sftp.sh,v 1.4 2003/05/14 22:08:27 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="basic sftp put/get with ssh.com server" 4tid="basic sftp put/get with ssh.com server"
5 5
6DATA=/bin/ls 6DATA=/bin/ls${EXEEXT}
7COPY=${OBJ}/copy 7COPY=${OBJ}/copy
8SFTPCMDFILE=${OBJ}/batch
9
10cat >$SFTPCMDFILE <<EOF
11version
12get $DATA ${COPY}.1
13put $DATA ${COPY}.2
14EOF
8 15
9BUFFERSIZE="5 1000 32000 64000" 16BUFFERSIZE="5 1000 32000 64000"
10REQUESTS="1 2 10" 17REQUESTS="1 2 10"
@@ -26,6 +33,8 @@ VERSIONS="
26 3.0.0 33 3.0.0
27 3.1.0 34 3.1.0
28 3.2.0 35 3.2.0
36 3.2.2
37 3.2.3
29 3.3.0" 38 3.3.0"
30 39
31# go for it 40# go for it
@@ -39,18 +48,17 @@ for v in ${VERSIONS}; do
39 for R in ${REQUESTS}; do 48 for R in ${REQUESTS}; do
40 verbose "test $tid: buffer_size $B num_requests $R" 49 verbose "test $tid: buffer_size $B num_requests $R"
41 rm -f ${COPY}.1 ${COPY}.2 50 rm -f ${COPY}.1 ${COPY}.2
42 ${SFTP} -P ${server} -B $B -R $R -b /dev/stdin \ 51 ${SFTP} -P ${server} -B $B -R $R -b $SFTPCMDFILE \
43 > /dev/null 2>&1 << EOF 52 > /dev/null 2>&1
44 version
45 get $DATA ${COPY}.1
46 put $DATA ${COPY}.2
47EOF
48 r=$? 53 r=$?
49 if [ $r -ne 0 ]; then 54 if [ $r -ne 0 ]; then
50 fail "sftp failed with $r" 55 fail "sftp failed with $r"
56 else
57 cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
58 cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
51 fi 59 fi
52 cmp $DATA ${COPY}.1 || fail "corrupted copy after get"
53 cmp $DATA ${COPY}.2 || fail "corrupted copy after put"
54 done 60 done
55 done 61 done
56done 62done
63rm -f ${COPY}.1 ${COPY}.2
64rm -f $SFTPCMDFILE
diff --git a/regress/ssh-com.sh b/regress/ssh-com.sh
index c2bd15380..78ae6e9e1 100644
--- a/regress/ssh-com.sh
+++ b/regress/ssh-com.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: ssh-com.sh,v 1.4 2002/07/16 08:58:16 markus Exp $ 1# $OpenBSD: ssh-com.sh,v 1.5 2003/05/14 22:08:27 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="connect to ssh.com server" 4tid="connect to ssh.com server"
@@ -18,6 +18,8 @@ VERSIONS="
18 3.0.0 18 3.0.0
19 3.1.0 19 3.1.0
20 3.2.0 20 3.2.0
21 3.2.2
22 3.2.3
21 3.3.0" 23 3.3.0"
22# 2.0.10 does not support UserConfigDirectory 24# 2.0.10 does not support UserConfigDirectory
23# 2.3.1 requires a config in $HOME/.ssh2 25# 2.3.1 requires a config in $HOME/.ssh2
@@ -65,7 +67,7 @@ done
65 67
66# convert and append DSA hostkey 68# convert and append DSA hostkey
67( 69(
68 echo -n 'ssh2-localhost-with-alias,127.0.0.1,::1 ' 70 echon 'ssh2-localhost-with-alias,127.0.0.1,::1 '
69 ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub 71 ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub
70) >> $OBJ/known_hosts 72) >> $OBJ/known_hosts
71 73
diff --git a/regress/stderr-after-eof.sh b/regress/stderr-after-eof.sh
index bebd700bf..05a5ea56d 100644
--- a/regress/stderr-after-eof.sh
+++ b/regress/stderr-after-eof.sh
@@ -7,13 +7,23 @@ DATA=/etc/motd
7DATA=${OBJ}/data 7DATA=${OBJ}/data
8COPY=${OBJ}/copy 8COPY=${OBJ}/copy
9 9
10MD5=md5sum 10if have_prog md5sum; then
11 CHECKSUM=md5sum
12elif have_prog openssl; then
13 CHECKSUM="openssl md5"
14elif have_prog cksum; then
15 CHECKSUM=cksum
16elif have_prog sum; then
17 CHECKSUM=sum
18else
19 fatal "No checksum program available, aborting $tid test"
20fi
11 21
12# setup data 22# setup data
13rm -f ${DATA} ${COPY} 23rm -f ${DATA} ${COPY}
14cp /dev/null ${DATA} 24cp /dev/null ${DATA}
15for i in 1 2 3 4 5 6; do 25for i in 1 2 3 4 5 6; do
16 (date;echo $i) | $MD5 >> ${DATA} 26 (date;echo $i) | $CHECKSUM >> ${DATA}
17done 27done
18 28
19${SSH} -2 -F $OBJ/ssh_proxy otherhost \ 29${SSH} -2 -F $OBJ/ssh_proxy otherhost \
diff --git a/regress/stderr-data.sh b/regress/stderr-data.sh
index 0157690b0..1daf79bb5 100644
--- a/regress/stderr-data.sh
+++ b/regress/stderr-data.sh
@@ -3,7 +3,7 @@
3 3
4tid="stderr data transfer" 4tid="stderr data transfer"
5 5
6DATA=/bin/ls 6DATA=/bin/ls${EXEEXT}
7COPY=${OBJ}/copy 7COPY=${OBJ}/copy
8rm -f ${COPY} 8rm -f ${COPY}
9 9
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index a7a8ddbe6..cc7ea67fe 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -2,10 +2,16 @@
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4PORT=4242 4PORT=4242
5USER=`id -un`
6SUDO=
7#SUDO=sudo 5#SUDO=sudo
8 6
7if [ -x /usr/ucb/whoami ]; then
8 USER=`/usr/ucb/whoami`
9elif whoami >/dev/null 2>&1; then
10 USER=`whoami`
11else
12 USER=`id -un`
13fi
14
9OBJ=$1 15OBJ=$1
10if [ "x$OBJ" = "x" ]; then 16if [ "x$OBJ" = "x" ]; then
11 echo '$OBJ not defined' 17 echo '$OBJ not defined'
@@ -72,6 +78,32 @@ export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER
72#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER 78#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER
73 79
74# helper 80# helper
81echon()
82{
83 if [ "x`echo -n`" = "x" ]; then
84 echo -n "$@"
85 elif [ "x`echo '\c'`" = "x" ]; then
86 echo "$@\c"
87 else
88 fatal "Don't know how to echo without newline."
89 fi
90}
91
92have_prog()
93{
94 saved_IFS="$IFS"
95 IFS=":"
96 for i in $PATH
97 do
98 if [ -x $i/$1 ]; then
99 IFS="$saved_IFS"
100 return 0
101 fi
102 done
103 IFS="$saved_IFS"
104 return 1
105}
106
75cleanup () 107cleanup ()
76{ 108{
77 if [ -f $PIDFILE ]; then 109 if [ -f $PIDFILE ]; then
@@ -111,7 +143,7 @@ fail ()
111 143
112fatal () 144fatal ()
113{ 145{
114 echo -n "FATAL: " 146 echon "FATAL: "
115 fail "$@" 147 fail "$@"
116 cleanup 148 cleanup
117 exit $RESULT 149 exit $RESULT
@@ -130,6 +162,7 @@ cat << EOF > $OBJ/sshd_config
130 PidFile $PIDFILE 162 PidFile $PIDFILE
131 AuthorizedKeysFile $OBJ/authorized_keys_%u 163 AuthorizedKeysFile $OBJ/authorized_keys_%u
132 LogLevel QUIET 164 LogLevel QUIET
165 StrictModes no
133EOF 166EOF
134 167
135# server config for proxy connects 168# server config for proxy connects
@@ -169,7 +202,7 @@ for t in rsa rsa1; do
169 202
170 # known hosts file for client 203 # known hosts file for client
171 ( 204 (
172 echo -n 'localhost-with-alias,127.0.0.1,::1 ' 205 echon 'localhost-with-alias,127.0.0.1,::1 '
173 cat $OBJ/$t.pub 206 cat $OBJ/$t.pub
174 ) >> $OBJ/known_hosts 207 ) >> $OBJ/known_hosts
175 208
@@ -189,7 +222,7 @@ chmod 644 $OBJ/authorized_keys_$USER
189# create a proxy version of the client config 222# create a proxy version of the client config
190( 223(
191 cat $OBJ/ssh_config 224 cat $OBJ/ssh_config
192 echo proxycommand ${SSHD} -i -f $OBJ/sshd_proxy 225 echo proxycommand ${SUDO} ${SSHD} -i -f $OBJ/sshd_proxy
193) > $OBJ/ssh_proxy 226) > $OBJ/ssh_proxy
194 227
195# check proxy config 228# check proxy config
@@ -203,7 +236,7 @@ start_sshd ()
203 236
204 trace "wait for sshd" 237 trace "wait for sshd"
205 i=0; 238 i=0;
206 while [ ! -f $PIDFILE -a $i -lt 5 ]; do 239 while [ ! -f $PIDFILE -a $i -lt 10 ]; do
207 i=`expr $i + 1` 240 i=`expr $i + 1`
208 sleep $i 241 sleep $i
209 done 242 done
diff --git a/regress/transfer.sh b/regress/transfer.sh
index 31cdc0ce3..13ea367d5 100644
--- a/regress/transfer.sh
+++ b/regress/transfer.sh
@@ -3,7 +3,7 @@
3 3
4tid="transfer data" 4tid="transfer data"
5 5
6DATA=/bin/ls 6DATA=/bin/ls${EXEEXT}
7COPY=${OBJ}/copy 7COPY=${OBJ}/copy
8 8
9for p in 1 2; do 9for p in 1 2; do
diff --git a/regress/try-ciphers.sh b/regress/try-ciphers.sh
index 161f039c0..2c727f66c 100644
--- a/regress/try-ciphers.sh
+++ b/regress/try-ciphers.sh
@@ -1,10 +1,11 @@
1# $OpenBSD: try-ciphers.sh,v 1.7 2002/04/03 09:30:01 markus Exp $ 1# $OpenBSD: try-ciphers.sh,v 1.8 2003/06/12 15:40:01 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="try ciphers" 4tid="try ciphers"
5 5
6ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc arcfour 6ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc arcfour
7 aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se" 7 aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se
8 aes128-ctr aes192-ctr aes256-ctr"
8macs="hmac-sha1 hmac-md5 hmac-sha1-96 hmac-md5-96" 9macs="hmac-sha1 hmac-md5 hmac-sha1-96 hmac-md5-96"
9 10
10for c in $ciphers; do 11for c in $ciphers; do
diff --git a/regress/yes-head.sh b/regress/yes-head.sh
index f213f6863..17a4d0dd4 100644
--- a/regress/yes-head.sh
+++ b/regress/yes-head.sh
@@ -4,7 +4,7 @@
4tid="yes pipe head" 4tid="yes pipe head"
5 5
6for p in 1 2; do 6for p in 1 2; do
7 lines=`${SSH} -$p -F $OBJ/ssh_proxy thishost 'yes | head -2000' | (sleep 3 ; wc -l)` 7 lines=`${SSH} -$p -F $OBJ/ssh_proxy thishost 'sh -c "while true;do echo yes;done | head -2000"' | (sleep 3 ; wc -l)`
8 if [ $? -ne 0 ]; then 8 if [ $? -ne 0 ]; then
9 fail "yes|head test failed" 9 fail "yes|head test failed"
10 lines = 0; 10 lines = 0;