diff options
Diffstat (limited to 'regress')
-rw-r--r-- | regress/Makefile | 61 | ||||
-rw-r--r-- | regress/README.regress | 86 | ||||
-rw-r--r-- | regress/agent-getpeereid.sh | 6 | ||||
-rw-r--r-- | regress/agent-ptrace.sh | 18 | ||||
-rw-r--r-- | regress/agent-timeout.sh | 12 | ||||
-rw-r--r-- | regress/agent.sh | 2 | ||||
-rw-r--r-- | regress/authorized_keys_root | 2 | ||||
-rwxr-xr-x | regress/copy.1 | bin | 45948 -> 0 bytes | |||
-rwxr-xr-x | regress/copy.2 | bin | 45948 -> 0 bytes | |||
-rw-r--r-- | regress/dynamic-forward.sh | 47 | ||||
-rw-r--r-- | regress/forwarding.sh | 7 | ||||
-rw-r--r-- | regress/proto-version.sh | 2 | ||||
-rw-r--r-- | regress/reconfigure.sh | 35 | ||||
-rw-r--r-- | regress/rekey.sh | 31 | ||||
-rw-r--r-- | regress/sftp-badcmds.sh | 78 | ||||
-rw-r--r-- | regress/sftp-batch.sh | 4 | ||||
-rw-r--r-- | regress/sftp-cmds.sh | 109 | ||||
-rw-r--r-- | regress/sftp.sh | 26 | ||||
-rw-r--r-- | regress/ssh-com-client.sh | 6 | ||||
-rw-r--r-- | regress/ssh-com-keygen.sh | 4 | ||||
-rw-r--r-- | regress/ssh-com-sftp.sh | 28 | ||||
-rw-r--r-- | regress/ssh-com.sh | 6 | ||||
-rw-r--r-- | regress/stderr-after-eof.sh | 14 | ||||
-rw-r--r-- | regress/stderr-data.sh | 2 | ||||
-rw-r--r-- | regress/test-exec.sh | 45 | ||||
-rw-r--r-- | regress/transfer.sh | 2 | ||||
-rw-r--r-- | regress/try-ciphers.sh | 5 | ||||
-rw-r--r-- | regress/yes-head.sh | 2 |
28 files changed, 552 insertions, 88 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 | ||
3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 | 3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec |
4 | tests: $(REGRESS_TARGETS) | ||
4 | 5 | ||
5 | CLEANFILES+= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 | 6 | clean: |
7 | for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done | ||
8 | distclean: clean | ||
6 | 9 | ||
7 | LTESTS= connect \ | 10 | LTESTS= 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 | ||
30 | USER!= id -un | 37 | USER!= id -un |
31 | CLEANFILES+= authorized_keys_${USER} known_hosts pidfile \ | 38 | CLEANFILES= 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 | ||
39 | t1: | 47 | t1: |
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 | ||
42 | t2: | 50 | t2: |
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 | ||
47 | t3: | 55 | t3: |
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 | ||
52 | t4: | 60 | t4: |
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 | ||
60 | t6: | 68 | t6: |
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 | ||
66 | t7.out: | 74 | $(OBJ)/t7.out: |
67 | ssh-keygen -q -t rsa -N '' -f $@ | 75 | ssh-keygen -q -t rsa -N '' -f $@ |
68 | 76 | ||
69 | t7: t7.out | 77 | t7: $(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} | 81 | t-exec: ${LTESTS:=.sh} |
74 | REGRESS_TARGETS+=t-${t} | 82 | @if [ "x$?" = "x" ]; then exit 0; fi; \ |
75 | t-${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 @@ | |||
1 | Overview. | ||
2 | |||
3 | $ ./configure && make tests | ||
4 | |||
5 | You'll see some progress info. A failure will cause either the make to | ||
6 | abort or the driver script to report a "FATAL" failure. | ||
7 | |||
8 | The test consists of 2 parts. The first is the file-based tests which is | ||
9 | driven by the Makefile, and the second is a set of network or proxycommand | ||
10 | based tests, which are driven by a driver script (test-exec.sh) which is | ||
11 | called multiple times by the Makefile. | ||
12 | |||
13 | Failures in the first part will cause the Makefile to return an error. | ||
14 | Failures in the second part will print a "FATAL" message for the failed | ||
15 | test and continue. | ||
16 | |||
17 | OpenBSD has a system-wide regression test suite. OpenSSH Portable's test | ||
18 | suite is based on OpenBSD's with modifications. | ||
19 | |||
20 | |||
21 | Environment variables. | ||
22 | |||
23 | SUDO: path to sudo command, if desired. Note that some systems (notably | ||
24 | systems using PAM) require sudo to execute some tests. | ||
25 | TEST_SSH_TRACE: set yo "yes" for verbose output from tests | ||
26 | TEST_SSH_QUIET: set to "yes" to suppress non-fatal output. | ||
27 | TEST_SSH_x: path to "ssh" command under test, where x=SSH,SSHD,SSHAGENT,SSHADD | ||
28 | SSHKEYGEN,SSHKEYSCAN,SFTP,SFTPSERVER | ||
29 | OBJ: used by test scripts to access build dir. | ||
30 | |||
31 | |||
32 | Individual tests. | ||
33 | |||
34 | You can invoke test-exec.sh directly if you set up the path to find the | ||
35 | binaries 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 | ||
39 | ok agent timeout test | ||
40 | |||
41 | |||
42 | Files. | ||
43 | |||
44 | test-exec.sh: the main test driver. Sets environment, creates config files | ||
45 | and keys and runs the specified test. | ||
46 | |||
47 | At the time of writing, the individual tests are: | ||
48 | agent-timeout.sh: agent timeout test | ||
49 | agent.sh: simple agent test | ||
50 | broken-pipe.sh: broken pipe test | ||
51 | connect-privsep.sh: proxy connect with privsep | ||
52 | connect.sh: simple connect | ||
53 | exit-status.sh: remote exit status | ||
54 | forwarding.sh: local and remote forwarding | ||
55 | keygen-change.sh: change passphrase for key | ||
56 | keyscan.sh: keyscan | ||
57 | proto-mismatch.sh: protocol version mismatch | ||
58 | proto-version.sh: sshd version with different protocol combinations | ||
59 | proxy-connect.sh: proxy connect | ||
60 | sftp.sh: basic sftp put/get | ||
61 | ssh-com-client.sh: connect with ssh.com client | ||
62 | ssh-com-keygen.sh: ssh.com key import | ||
63 | ssh-com-sftp.sh: basic sftp put/get with ssh.com server | ||
64 | ssh-com.sh: connect to ssh.com server | ||
65 | stderr-after-eof.sh: stderr data after eof | ||
66 | stderr-data.sh: stderr data transfer | ||
67 | transfer.sh: transfer data | ||
68 | try-ciphers.sh: try ciphers | ||
69 | yes-head.sh: yes pipe head | ||
70 | |||
71 | |||
72 | Problems? | ||
73 | |||
74 | Run the failing test with shell tracing (-x) turned on: | ||
75 | $ PATH=`pwd`/..:$PATH:. sh -x test-exec.sh `pwd` agent-timeout.sh | ||
76 | |||
77 | Failed 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 | |||
83 | Known 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 | |||
7 | ASOCK=${OBJ}/agent | 7 | ASOCK=${OBJ}/agent |
8 | SSH_AUTH_SOCK=/nonexistant | 8 | SSH_AUTH_SOCK=/nonexistant |
9 | 9 | ||
10 | if grep "#undef.*HAVE_GETPEEREID" ${BUILDDIR}/config.h >/dev/null 2>&1 | ||
11 | then | ||
12 | echo "skipped (not supported on this platform)" | ||
13 | exit 0 | ||
14 | fi | ||
15 | |||
10 | trace "start agent" | 16 | trace "start agent" |
11 | eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null | 17 | eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null |
12 | r=$? | 18 | r=$? |
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 | ||
4 | tid="disallow agent ptrace attach" | 4 | tid="disallow agent ptrace attach" |
5 | 5 | ||
6 | if 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 | ||
13 | fi | ||
14 | |||
15 | if have_prog gdb ; then | ||
16 | : ok | ||
17 | else | ||
18 | echo "skipped (gdb not found)" | ||
19 | exit 0 | ||
20 | fi | ||
21 | |||
6 | trace "start agent" | 22 | trace "start agent" |
7 | eval `${SSHAGENT} -s` > /dev/null | 23 | eval `${SSHAGENT} -s` > /dev/null |
8 | r=$? | 24 | r=$? |
@@ -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 | ||
4 | tid="agent timeout test" | 4 | tid="agent timeout test" |
5 | 5 | ||
6 | TIMEOUT=5 | 6 | SSHAGENT_TIMEOUT=10 |
7 | 7 | ||
8 | trace "start agent" | 8 | trace "start agent" |
9 | eval `${SSHAGENT} -s` > /dev/null | 9 | eval `${SSHAGENT} -s` > /dev/null |
@@ -13,7 +13,7 @@ if [ $r -ne 0 ]; then | |||
13 | else | 13 | else |
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/authorized_keys_root b/regress/authorized_keys_root deleted file mode 100644 index 328537120..000000000 --- a/regress/authorized_keys_root +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAt6ttBacbgvLPsF1VWWfT51t55/5Mj62Xp8EaoH5SNSaLiGIgrrja077lKEept75U4uKFUYU5JJX9GPE9A7Y43LXv+/A6Jm4rEj/U0s4H8tf0UmzVC3t6xh0sRK0hYVNILyoHnIAgdY8CmOiybw7p6DxJY8MRAehD3n9+kFcachU= root@xenon | ||
2 | 1024 35 132789427207755621599908461558918671787816692978751485815532032934821830960131244604702969298486352138126114080367609979552547448841583955126231410604842765726397407176910594168641969541792069550006878863592030567875913190224374005367884774859544943329148178663694126456638431428703289837638970464685771819219 root@xenon | ||
diff --git a/regress/copy.1 b/regress/copy.1 deleted file mode 100755 index 92d4d20f9..000000000 --- a/regress/copy.1 +++ /dev/null | |||
Binary files differ | |||
diff --git a/regress/copy.2 b/regress/copy.2 deleted file mode 100755 index 92d4d20f9..000000000 --- a/regress/copy.2 +++ /dev/null | |||
Binary files differ | |||
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 | |||
4 | tid="dynamic forwarding" | ||
5 | |||
6 | PORT=4242 | ||
7 | FWDPORT=4243 | ||
8 | DATA=/bin/ls${EXEEXT} | ||
9 | |||
10 | if have_prog nc && nc -h 2>&1 | grep "x proxy address" >/dev/null; then | ||
11 | proxycmd="nc -x 127.0.0.1:$FWDPORT -X" | ||
12 | elif have_prog connect; then | ||
13 | proxycmd="connect -S 127.0.0.1:$FWDPORT -" | ||
14 | else | ||
15 | echo "skipped (no suitable ProxyCommand found)" | ||
16 | exit 0 | ||
17 | fi | ||
18 | trace "will use ProxyCommand $proxycmd" | ||
19 | |||
20 | start_sshd | ||
21 | |||
22 | for 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 | ||
47 | done | ||
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 | ||
4 | tid="local and remote forwarding" | 4 | tid="local and remote forwarding" |
5 | DATA=/bin/ls${EXEEXT} | ||
5 | 6 | ||
6 | start_sshd | 7 | start_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 |
33 | done | 34 | done |
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 | |||
4 | tid="simple connect after reconfigure" | ||
5 | |||
6 | # we need the full path to sshd for -HUP | ||
7 | case $SSHD in | ||
8 | /*) | ||
9 | # full path is OK | ||
10 | ;; | ||
11 | *) | ||
12 | # otherwise make fully qualified | ||
13 | SSHD=$OBJ/$SSHD | ||
14 | esac | ||
15 | |||
16 | start_sshd | ||
17 | |||
18 | $SUDO kill -HUP `cat $PIDFILE` | ||
19 | sleep 1 | ||
20 | |||
21 | trace "wait for sshd to restart" | ||
22 | i=0; | ||
23 | while [ ! -f $PIDFILE -a $i -lt 10 ]; do | ||
24 | i=`expr $i + 1` | ||
25 | sleep $i | ||
26 | done | ||
27 | |||
28 | test -f $PIDFILE || fatal "sshd did not restart" | ||
29 | |||
30 | for 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 | ||
35 | done | ||
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 | |||
4 | tid="rekey during transfer data" | ||
5 | |||
6 | DATA=${OBJ}/data | ||
7 | COPY=${OBJ}/copy | ||
8 | LOG=${OBJ}/log | ||
9 | |||
10 | rm -f ${COPY} ${LOG} ${DATA} | ||
11 | dd if=/bin/ls${EXEEXT} of=${DATA} bs=1k seek=511 count=1 > /dev/null 2>&1 | ||
12 | |||
13 | for 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 | ||
30 | done | ||
31 | rm -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 | |||
4 | tid="sftp invalid commands" | ||
5 | |||
6 | DATA=/bin/ls${EXEEXT} | ||
7 | DATA2=/bin/cat${EXEEXT} | ||
8 | NONEXIST=/NONEXIST.$$ | ||
9 | COPY=${OBJ}/copy | ||
10 | GLOBFILES=`(cd /bin;echo l*)` | ||
11 | |||
12 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd | ||
13 | |||
14 | rm -f ${COPY} | ||
15 | verbose "$tid: get nonexistent" | ||
16 | echo "get $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
17 | || fail "get nonexistent failed" | ||
18 | test -f ${COPY} && fail "existing copy after get nonexistent" | ||
19 | |||
20 | rm -f ${COPY}.dd/* | ||
21 | verbose "$tid: glob get to nonexistent directory" | ||
22 | echo "get /bin/l* $NONEXIST" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
23 | || fail "get nonexistent failed" | ||
24 | for x in $GLOBFILES; do | ||
25 | test -f ${COPY}.dd/$x && fail "existing copy after get nonexistent" | ||
26 | done | ||
27 | |||
28 | rm -f ${COPY} | ||
29 | verbose "$tid: put nonexistent" | ||
30 | echo "put $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
31 | || fail "put nonexistent failed" | ||
32 | test -f ${COPY} && fail "existing copy after put nonexistent" | ||
33 | |||
34 | rm -f ${COPY}.dd/* | ||
35 | verbose "$tid: glob put to nonexistent directory" | ||
36 | echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
37 | || fail "put nonexistent failed" | ||
38 | for x in $GLOBFILES; do | ||
39 | test -f ${COPY}.dd/$x && fail "existing copy after nonexistent" | ||
40 | done | ||
41 | |||
42 | rm -f ${COPY} | ||
43 | verbose "$tid: rename nonexistent" | ||
44 | echo "rename $NONEXIST ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
45 | || fail "rename nonexist failed" | ||
46 | test -f ${COPY}.1 && fail "file exists after rename nonexistent" | ||
47 | |||
48 | rm -f ${COPY} ${COPY}.1 | ||
49 | cp $DATA $COPY | ||
50 | cp $DATA2 ${COPY}.1 | ||
51 | verbose "$tid: rename target exists" | ||
52 | echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
53 | || fail "rename target exists failed" | ||
54 | test -f ${COPY} || fail "oldname missing after rename target exists" | ||
55 | test -f ${COPY}.1 || fail "newname missing after rename target exists" | ||
56 | cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists" | ||
57 | cmp $DATA2 ${COPY}.1 >/dev/null 2>&1 || fail "corrupted newname after rename target exists" | ||
58 | |||
59 | rm -rf ${COPY} ${COPY}.dd | ||
60 | cp $DATA $COPY | ||
61 | mkdir ${COPY}.dd | ||
62 | verbose "$tid: rename target exists (directory)" | ||
63 | echo "rename $COPY ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
64 | || fail "rename target exists (directory) failed" | ||
65 | test -f ${COPY} || fail "oldname missing after rename target exists (directory)" | ||
66 | test -d ${COPY}.dd || fail "newname missing after rename target exists (directory)" | ||
67 | cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists (directory)" | ||
68 | |||
69 | rm -f ${COPY}.dd/* | ||
70 | rm -rf ${COPY} | ||
71 | cp ${DATA2} ${COPY} | ||
72 | verbose "$tid: glob put files to local file" | ||
73 | echo "put /bin/l* $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 | ||
74 | cmp ${DATA2} ${COPY} || fail "put successed when it should have failed" | ||
75 | |||
76 | rm -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 | ||
4 | tid="sftp batchfile" | 4 | tid="sftp batchfile" |
5 | 5 | ||
6 | DATA=/bin/ls | 6 | DATA=/bin/ls${EXEEXT} |
7 | COPY=${OBJ}/copy | 7 | COPY=${OBJ}/copy |
8 | BATCH=${OBJ}/sftp-batch | 8 | BATCH=${OBJ}/sftp-batch.tmp |
9 | 9 | ||
10 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* | 10 | rm -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 | ||
9 | tid="sftp commands" | 8 | tid="sftp commands" |
10 | 9 | ||
11 | DATA=/bin/ls | 10 | DATA=/bin/ls${EXEEXT} |
12 | COPY=${OBJ}/copy | 11 | COPY=${OBJ}/copy |
13 | 12 | # test that these files are readable! | |
14 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* | 13 | for i in `(cd /bin;echo l*)` |
14 | do | ||
15 | if [ -r $i ]; then | ||
16 | GLOBFILES="$GLOBFILES $i" | ||
17 | fi | ||
18 | done | ||
19 | |||
20 | if have_prog uname | ||
21 | then | ||
22 | case `uname` in | ||
23 | CYGWIN*) | ||
24 | os=cygwin | ||
25 | ;; | ||
26 | *) | ||
27 | os=`uname` | ||
28 | ;; | ||
29 | esac | ||
30 | else | ||
31 | os="unknown" | ||
32 | fi | ||
33 | |||
34 | # Path with embedded quote | ||
35 | QUOTECOPY=${COPY}".\"blah\"" | ||
36 | QUOTECOPY_ARG=${COPY}'.\"blah\"' | ||
37 | |||
38 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 | ||
39 | mkdir ${COPY}.dd | ||
15 | 40 | ||
16 | verbose "$tid: lls" | 41 | verbose "$tid: lls" |
17 | echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 42 | echo "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" |
55 | cmp $DATA ${COPY} || fail "corrupted copy after get" | 80 | cmp $DATA ${COPY} || fail "corrupted copy after get" |
56 | 81 | ||
82 | rm -f ${COPY}.dd/* | ||
83 | verbose "$tid: get to directory" | ||
84 | echo "get $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
85 | || fail "get failed" | ||
86 | cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get" | ||
87 | |||
88 | rm -f ${COPY}.dd/* | ||
89 | verbose "$tid: glob get to directory" | ||
90 | echo "get /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
91 | || fail "get failed" | ||
92 | for x in $GLOBFILES; do | ||
93 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get" | ||
94 | done | ||
95 | |||
96 | rm -f ${COPY}.dd/* | ||
97 | verbose "$tid: get to local dir" | ||
98 | (echo "lcd ${COPY}.dd"; echo "get $DATA" ) | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
99 | || fail "get failed" | ||
100 | cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get" | ||
101 | |||
102 | rm -f ${COPY}.dd/* | ||
103 | verbose "$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" | ||
106 | for x in $GLOBFILES; do | ||
107 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get" | ||
108 | done | ||
109 | |||
57 | rm -f ${COPY} | 110 | rm -f ${COPY} |
58 | verbose "$tid: put" | 111 | verbose "$tid: put" |
59 | echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 112 | echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
60 | || fail "put failed" | 113 | || fail "put failed" |
61 | cmp $DATA ${COPY} || fail "corrupted copy after put" | 114 | cmp $DATA ${COPY} || fail "corrupted copy after put" |
62 | 115 | ||
116 | if [ "$os" != "cygwin" ]; then | ||
117 | rm -f ${QUOTECOPY} | ||
118 | verbose "$tid: put filename with quotes" | ||
119 | echo "put $DATA \"$QUOTECOPY_ARG\"" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
120 | || fail "put failed" | ||
121 | cmp $DATA ${QUOTECOPY} || fail "corrupted copy after put with quotes" | ||
122 | fi | ||
123 | |||
124 | rm -f ${COPY}.dd/* | ||
125 | verbose "$tid: put to directory" | ||
126 | echo "put $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
127 | || fail "put failed" | ||
128 | cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put" | ||
129 | |||
130 | rm -f ${COPY}.dd/* | ||
131 | verbose "$tid: glob put to directory" | ||
132 | echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
133 | || fail "put failed" | ||
134 | for x in $GLOBFILES; do | ||
135 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put" | ||
136 | done | ||
137 | |||
138 | rm -f ${COPY}.dd/* | ||
139 | verbose "$tid: put to local dir" | ||
140 | (echo "cd ${COPY}.dd"; echo "put $DATA") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
141 | || fail "put failed" | ||
142 | cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put" | ||
143 | |||
144 | rm -f ${COPY}.dd/* | ||
145 | verbose "$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" | ||
148 | for x in $GLOBFILES; do | ||
149 | cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put" | ||
150 | done | ||
151 | |||
63 | verbose "$tid: rename" | 152 | verbose "$tid: rename" |
64 | echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 153 | echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
65 | || fail "rename failed" | 154 | || fail "rename failed" |
66 | test -f ${COPY}.1 || fail "missing file after rename" | 155 | test -f ${COPY}.1 || fail "missing file after rename" |
67 | cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" | 156 | cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" |
68 | 157 | ||
158 | verbose "$tid: rename directory" | ||
159 | echo "rename ${COPY}.dd ${COPY}.dd2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | ||
160 | || fail "rename directory failed" | ||
161 | test -d ${COPY}.dd && fail "oldname exists after rename directory" | ||
162 | test -d ${COPY}.dd2 || fail "missing newname after rename directory" | ||
163 | |||
69 | verbose "$tid: ln" | 164 | verbose "$tid: ln" |
70 | echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed" | 165 | echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed" |
71 | test -L ${COPY}.2 || fail "missing file after ln" | 166 | test -h ${COPY}.2 || fail "missing file after ln" |
72 | 167 | ||
73 | verbose "$tid: mkdir" | 168 | verbose "$tid: mkdir" |
74 | echo "mkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 169 | echo "mkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
@@ -95,6 +190,6 @@ verbose "$tid: lchdir" | |||
95 | echo "lchdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ | 190 | echo "lchdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ |
96 | || fail "lchdir failed" | 191 | || fail "lchdir failed" |
97 | 192 | ||
98 | rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* | 193 | rm -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 | ||
4 | tid="basic sftp put/get" | 4 | tid="basic sftp put/get" |
5 | 5 | ||
6 | DATA=/bin/ls | 6 | DATA=/bin/ls${EXEEXT} |
7 | COPY=${OBJ}/copy | 7 | COPY=${OBJ}/copy |
8 | 8 | ||
9 | SFTPCMDFILE=${OBJ}/batch | ||
10 | cat >$SFTPCMDFILE <<EOF | ||
11 | version | ||
12 | get $DATA ${COPY}.1 | ||
13 | put $DATA ${COPY}.2 | ||
14 | EOF | ||
15 | |||
9 | BUFFERSIZE="5 1000 32000 64000" | 16 | BUFFERSIZE="5 1000 32000 64000" |
10 | REQUESTS="1 2 10" | 17 | REQUESTS="1 2 10" |
11 | 18 | ||
12 | for B in ${BUFFERSIZE}; do | 19 | for 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 | ||
21 | EOF | ||
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 |
29 | done | 33 | done |
34 | rm -f ${COPY}.1 ${COPY}.2 | ||
35 | rm -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 | ||
4 | tid="connect with ssh.com client" | 4 | tid="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) |
63 | start_sshd | 65 | start_sshd |
64 | 66 | ||
65 | DATA=/bin/ls | 67 | DATA=/bin/ls${EXEEXT} |
66 | COPY=${OBJ}/copy | 68 | COPY=${OBJ}/copy |
67 | rm -f ${COPY} | 69 | rm -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 | ||
4 | tid="ssh.com key import" | 4 | tid="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 | ||
25 | COMPRV=${OBJ}/comkey | 27 | COMPRV=${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 | ||
4 | tid="basic sftp put/get with ssh.com server" | 4 | tid="basic sftp put/get with ssh.com server" |
5 | 5 | ||
6 | DATA=/bin/ls | 6 | DATA=/bin/ls${EXEEXT} |
7 | COPY=${OBJ}/copy | 7 | COPY=${OBJ}/copy |
8 | SFTPCMDFILE=${OBJ}/batch | ||
9 | |||
10 | cat >$SFTPCMDFILE <<EOF | ||
11 | version | ||
12 | get $DATA ${COPY}.1 | ||
13 | put $DATA ${COPY}.2 | ||
14 | EOF | ||
8 | 15 | ||
9 | BUFFERSIZE="5 1000 32000 64000" | 16 | BUFFERSIZE="5 1000 32000 64000" |
10 | REQUESTS="1 2 10" | 17 | REQUESTS="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 | ||
47 | EOF | ||
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 |
56 | done | 62 | done |
63 | rm -f ${COPY}.1 ${COPY}.2 | ||
64 | rm -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 | ||
4 | tid="connect to ssh.com server" | 4 | tid="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 | |||
7 | DATA=${OBJ}/data | 7 | DATA=${OBJ}/data |
8 | COPY=${OBJ}/copy | 8 | COPY=${OBJ}/copy |
9 | 9 | ||
10 | MD5=md5sum | 10 | if have_prog md5sum; then |
11 | CHECKSUM=md5sum | ||
12 | elif have_prog openssl; then | ||
13 | CHECKSUM="openssl md5" | ||
14 | elif have_prog cksum; then | ||
15 | CHECKSUM=cksum | ||
16 | elif have_prog sum; then | ||
17 | CHECKSUM=sum | ||
18 | else | ||
19 | fatal "No checksum program available, aborting $tid test" | ||
20 | fi | ||
11 | 21 | ||
12 | # setup data | 22 | # setup data |
13 | rm -f ${DATA} ${COPY} | 23 | rm -f ${DATA} ${COPY} |
14 | cp /dev/null ${DATA} | 24 | cp /dev/null ${DATA} |
15 | for i in 1 2 3 4 5 6; do | 25 | for i in 1 2 3 4 5 6; do |
16 | (date;echo $i) | $MD5 >> ${DATA} | 26 | (date;echo $i) | $CHECKSUM >> ${DATA} |
17 | done | 27 | done |
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 | ||
4 | tid="stderr data transfer" | 4 | tid="stderr data transfer" |
5 | 5 | ||
6 | DATA=/bin/ls | 6 | DATA=/bin/ls${EXEEXT} |
7 | COPY=${OBJ}/copy | 7 | COPY=${OBJ}/copy |
8 | rm -f ${COPY} | 8 | rm -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 | ||
4 | PORT=4242 | 4 | PORT=4242 |
5 | USER=`id -un` | ||
6 | SUDO= | ||
7 | #SUDO=sudo | 5 | #SUDO=sudo |
8 | 6 | ||
7 | if [ -x /usr/ucb/whoami ]; then | ||
8 | USER=`/usr/ucb/whoami` | ||
9 | elif whoami >/dev/null 2>&1; then | ||
10 | USER=`whoami` | ||
11 | else | ||
12 | USER=`id -un` | ||
13 | fi | ||
14 | |||
9 | OBJ=$1 | 15 | OBJ=$1 |
10 | if [ "x$OBJ" = "x" ]; then | 16 | if [ "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 |
81 | echon() | ||
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 | |||
92 | have_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 | |||
75 | cleanup () | 107 | cleanup () |
76 | { | 108 | { |
77 | if [ -f $PIDFILE ]; then | 109 | if [ -f $PIDFILE ]; then |
@@ -111,7 +143,7 @@ fail () | |||
111 | 143 | ||
112 | fatal () | 144 | fatal () |
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 | ||
133 | EOF | 166 | EOF |
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 | ||
4 | tid="transfer data" | 4 | tid="transfer data" |
5 | 5 | ||
6 | DATA=/bin/ls | 6 | DATA=/bin/ls${EXEEXT} |
7 | COPY=${OBJ}/copy | 7 | COPY=${OBJ}/copy |
8 | 8 | ||
9 | for p in 1 2; do | 9 | for 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 | ||
4 | tid="try ciphers" | 4 | tid="try ciphers" |
5 | 5 | ||
6 | ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc arcfour | 6 | ciphers="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" | ||
8 | macs="hmac-sha1 hmac-md5 hmac-sha1-96 hmac-md5-96" | 9 | macs="hmac-sha1 hmac-md5 hmac-sha1-96 hmac-md5-96" |
9 | 10 | ||
10 | for c in $ciphers; do | 11 | for 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 @@ | |||
4 | tid="yes pipe head" | 4 | tid="yes pipe head" |
5 | 5 | ||
6 | for p in 1 2; do | 6 | for 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; |