diff options
Diffstat (limited to 'regress')
-rw-r--r-- | regress/Makefile | 12 | ||||
-rw-r--r-- | regress/agent-ptrace.sh | 4 | ||||
-rw-r--r-- | regress/brokenkeys.sh | 23 | ||||
-rw-r--r-- | regress/dynamic-forward.sh | 5 | ||||
-rw-r--r-- | regress/envpass.sh | 21 | ||||
-rw-r--r-- | regress/login-timeout.sh | 6 | ||||
-rw-r--r-- | regress/multiplex.sh | 34 | ||||
-rw-r--r-- | regress/reexec.sh | 73 | ||||
-rw-r--r-- | regress/rekey.sh | 1 | ||||
-rw-r--r-- | regress/scp.sh | 25 | ||||
-rw-r--r-- | regress/sftp-glob.sh | 28 | ||||
-rw-r--r-- | regress/sshd-log-wrapper.sh | 13 | ||||
-rw-r--r-- | regress/test-exec.sh | 34 |
13 files changed, 199 insertions, 80 deletions
diff --git a/regress/Makefile b/regress/Makefile index 9e98e5880..4f47bc3fd 100644 --- a/regress/Makefile +++ b/regress/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.31 2004/06/24 19:32:00 djm Exp $ | 1 | # $OpenBSD: Makefile,v 1.36 2005/03/04 08:48:46 djm Exp $ |
2 | 2 | ||
3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec | 3 | REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec |
4 | tests: $(REGRESS_TARGETS) | 4 | tests: $(REGRESS_TARGETS) |
@@ -34,20 +34,22 @@ LTESTS= connect \ | |||
34 | sftp-cmds \ | 34 | sftp-cmds \ |
35 | sftp-badcmds \ | 35 | sftp-badcmds \ |
36 | sftp-batch \ | 36 | sftp-batch \ |
37 | sftp-glob \ | ||
37 | reconfigure \ | 38 | reconfigure \ |
38 | dynamic-forward \ | 39 | dynamic-forward \ |
39 | forwarding \ | 40 | forwarding \ |
40 | multiplex \ | 41 | multiplex \ |
41 | reexec | 42 | reexec \ |
43 | brokenkeys | ||
42 | 44 | ||
43 | USER!= id -un | 45 | USER!= id -un |
44 | CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ | 46 | CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ |
45 | authorized_keys_${USER} known_hosts pidfile \ | 47 | authorized_keys_${USER} known_hosts pidfile \ |
46 | ssh_config ssh_proxy sshd_config sshd_proxy \ | 48 | ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \ |
47 | rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \ | 49 | rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \ |
48 | rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \ | 50 | rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \ |
49 | ls.copy banner.in banner.out empty.in \ | 51 | ls.copy banner.in banner.out empty.in \ |
50 | scp-ssh-wrapper.exe \ | 52 | scp-ssh-wrapper.scp ssh_proxy_envpass \ |
51 | remote_pid | 53 | remote_pid |
52 | 54 | ||
53 | #LTESTS += ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp | 55 | #LTESTS += ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp |
@@ -90,5 +92,5 @@ t-exec: ${LTESTS:=.sh} | |||
90 | @if [ "x$?" = "x" ]; then exit 0; fi; \ | 92 | @if [ "x$?" = "x" ]; then exit 0; fi; \ |
91 | for TEST in ""$?; do \ | 93 | for TEST in ""$?; do \ |
92 | echo "run test $${TEST}" ... 1>&2; \ | 94 | echo "run test $${TEST}" ... 1>&2; \ |
93 | (sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \ | 95 | (env SUDO=${SUDO} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \ |
94 | done | 96 | done |
diff --git a/regress/agent-ptrace.sh b/regress/agent-ptrace.sh index bd79d7cb8..4de2638e4 100644 --- a/regress/agent-ptrace.sh +++ b/regress/agent-ptrace.sh | |||
@@ -5,7 +5,7 @@ tid="disallow agent ptrace attach" | |||
5 | 5 | ||
6 | if have_prog uname ; then | 6 | if have_prog uname ; then |
7 | case `uname` in | 7 | case `uname` in |
8 | AIX|CYGWIN*) | 8 | AIX|CYGWIN*|OSF1) |
9 | echo "skipped (not supported on this platform)" | 9 | echo "skipped (not supported on this platform)" |
10 | exit 0 | 10 | exit 0 |
11 | ;; | 11 | ;; |
@@ -41,7 +41,7 @@ EOF | |||
41 | if [ $? -ne 0 ]; then | 41 | if [ $? -ne 0 ]; then |
42 | fail "gdb failed: exit code $?" | 42 | fail "gdb failed: exit code $?" |
43 | fi | 43 | fi |
44 | egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace attach: Permission denied.' >/dev/null ${OBJ}/gdb.out | 44 | egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace attach: Permission denied.|procfs:.*: Invalid argument.' >/dev/null ${OBJ}/gdb.out |
45 | r=$? | 45 | r=$? |
46 | rm -f ${OBJ}/gdb.out | 46 | rm -f ${OBJ}/gdb.out |
47 | if [ $r -ne 0 ]; then | 47 | if [ $r -ne 0 ]; then |
diff --git a/regress/brokenkeys.sh b/regress/brokenkeys.sh new file mode 100644 index 000000000..3e70c348a --- /dev/null +++ b/regress/brokenkeys.sh | |||
@@ -0,0 +1,23 @@ | |||
1 | # $OpenBSD: brokenkeys.sh,v 1.1 2004/10/29 23:59:22 djm Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="broken keys" | ||
5 | |||
6 | KEYS="$OBJ/authorized_keys_${USER}" | ||
7 | |||
8 | start_sshd | ||
9 | |||
10 | mv ${KEYS} ${KEYS}.bak | ||
11 | |||
12 | # Truncated key | ||
13 | echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEABTM= bad key" > $KEYS | ||
14 | cat ${KEYS}.bak >> ${KEYS} | ||
15 | cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER | ||
16 | |||
17 | ${SSH} -2 -F $OBJ/ssh_config somehost true | ||
18 | if [ $? -ne 0 ]; then | ||
19 | fail "ssh connect with protocol $p failed" | ||
20 | fi | ||
21 | |||
22 | mv ${KEYS}.bak ${KEYS} | ||
23 | |||
diff --git a/regress/dynamic-forward.sh b/regress/dynamic-forward.sh index 392fc1978..4674a7baf 100644 --- a/regress/dynamic-forward.sh +++ b/regress/dynamic-forward.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: dynamic-forward.sh,v 1.3 2004/02/28 12:16:57 dtucker Exp $ | 1 | # $OpenBSD: dynamic-forward.sh,v 1.4 2004/06/22 22:55:56 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="dynamic forwarding" | 4 | tid="dynamic forwarding" |
@@ -44,4 +44,7 @@ for p in 1 2; do | |||
44 | else | 44 | else |
45 | fail "no pid file: $OBJ/remote_pid" | 45 | fail "no pid file: $OBJ/remote_pid" |
46 | fi | 46 | fi |
47 | |||
48 | # Must allow time for connection tear-down | ||
49 | sleep 2 | ||
47 | done | 50 | done |
diff --git a/regress/envpass.sh b/regress/envpass.sh index 5a7e178d8..af7eafe3d 100644 --- a/regress/envpass.sh +++ b/regress/envpass.sh | |||
@@ -1,13 +1,20 @@ | |||
1 | # $OpenBSD: envpass.sh,v 1.3 2004/06/22 22:42:02 dtucker Exp $ | 1 | # $OpenBSD: envpass.sh,v 1.4 2005/03/04 08:48:46 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="environment passing" | 4 | tid="environment passing" |
5 | 5 | ||
6 | # NB accepted env vars are in test-exec.sh (_XXX_TEST_* and _XXX_TEST) | 6 | # NB accepted env vars are in test-exec.sh (_XXX_TEST_* and _XXX_TEST) |
7 | 7 | ||
8 | # Prepare a custom config to test for a configuration parsing bug fixed in 4.0 | ||
9 | cat << EOF > $OBJ/ssh_proxy_envpass | ||
10 | Host test-sendenv-confparse-bug | ||
11 | SendEnv * | ||
12 | EOF | ||
13 | cat $OBJ/ssh_proxy >> $OBJ/ssh_proxy_envpass | ||
14 | |||
8 | trace "pass env, don't accept" | 15 | trace "pass env, don't accept" |
9 | verbose "test $tid: pass env, don't accept" | 16 | verbose "test $tid: pass env, don't accept" |
10 | _TEST_ENV=blah ${SSH} -oSendEnv="*" -F $OBJ/ssh_proxy otherhost \ | 17 | _TEST_ENV=blah ${SSH} -oSendEnv="*" -F $OBJ/ssh_proxy_envpass otherhost \ |
11 | sh << 'EOF' | 18 | sh << 'EOF' |
12 | test -z "$_TEST_ENV" | 19 | test -z "$_TEST_ENV" |
13 | EOF | 20 | EOF |
@@ -18,7 +25,7 @@ fi | |||
18 | 25 | ||
19 | trace "don't pass env, accept" | 26 | trace "don't pass env, accept" |
20 | verbose "test $tid: don't pass env, accept" | 27 | verbose "test $tid: don't pass env, accept" |
21 | ${SSH} -F $OBJ/ssh_proxy otherhost \ | 28 | _XXX_TEST_A=1 _XXX_TEST_B=2 ${SSH} -F $OBJ/ssh_proxy_envpass otherhost \ |
22 | sh << 'EOF' | 29 | sh << 'EOF' |
23 | test -z "$_XXX_TEST_A" && test -z "$_XXX_TEST_B" | 30 | test -z "$_XXX_TEST_A" && test -z "$_XXX_TEST_B" |
24 | EOF | 31 | EOF |
@@ -29,8 +36,8 @@ fi | |||
29 | 36 | ||
30 | trace "pass single env, accept single env" | 37 | trace "pass single env, accept single env" |
31 | verbose "test $tid: pass single env, accept single env" | 38 | verbose "test $tid: pass single env, accept single env" |
32 | _XXX_TEST=blah ${SSH} -oSendEnv="_XXX_TEST" -F $OBJ/ssh_proxy otherhost \ | 39 | _XXX_TEST=blah ${SSH} -oSendEnv="_XXX_TEST" -F $OBJ/ssh_proxy_envpass \ |
33 | sh << 'EOF' | 40 | otherhost sh << 'EOF' |
34 | test X"$_XXX_TEST" = X"blah" | 41 | test X"$_XXX_TEST" = X"blah" |
35 | EOF | 42 | EOF |
36 | r=$? | 43 | r=$? |
@@ -41,7 +48,7 @@ fi | |||
41 | trace "pass multiple env, accept multiple env" | 48 | trace "pass multiple env, accept multiple env" |
42 | verbose "test $tid: pass multiple env, accept multiple env" | 49 | verbose "test $tid: pass multiple env, accept multiple env" |
43 | _XXX_TEST_A=1 _XXX_TEST_B=2 ${SSH} -oSendEnv="_XXX_TEST_*" \ | 50 | _XXX_TEST_A=1 _XXX_TEST_B=2 ${SSH} -oSendEnv="_XXX_TEST_*" \ |
44 | -F $OBJ/ssh_proxy otherhost \ | 51 | -F $OBJ/ssh_proxy_envpass otherhost \ |
45 | sh << 'EOF' | 52 | sh << 'EOF' |
46 | test X"$_XXX_TEST_A" = X"1" -a X"$_XXX_TEST_B" = X"2" | 53 | test X"$_XXX_TEST_A" = X"1" -a X"$_XXX_TEST_B" = X"2" |
47 | EOF | 54 | EOF |
@@ -49,3 +56,5 @@ r=$? | |||
49 | if [ $r -ne 0 ]; then | 56 | if [ $r -ne 0 ]; then |
50 | fail "environment not found" | 57 | fail "environment not found" |
51 | fi | 58 | fi |
59 | |||
60 | rm -f $OBJ/ssh_proxy_envpass | ||
diff --git a/regress/login-timeout.sh b/regress/login-timeout.sh index ce6edade5..15a887f74 100644 --- a/regress/login-timeout.sh +++ b/regress/login-timeout.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: login-timeout.sh,v 1.3 2004/03/08 10:17:12 dtucker Exp $ | 1 | # $OpenBSD: login-timeout.sh,v 1.4 2005/02/27 23:13:36 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="connect after login grace timeout" | 4 | tid="connect after login grace timeout" |
@@ -8,7 +8,7 @@ echo "LoginGraceTime 10s" >> $OBJ/sshd_config | |||
8 | echo "MaxStartups 1" >> $OBJ/sshd_config | 8 | echo "MaxStartups 1" >> $OBJ/sshd_config |
9 | start_sshd | 9 | start_sshd |
10 | 10 | ||
11 | (echo SSH-2.0-fake; sleep 60) | telnet localhost ${PORT} >/dev/null 2>&1 & | 11 | (echo SSH-2.0-fake; sleep 60) | telnet 127.0.0.1 ${PORT} >/dev/null 2>&1 & |
12 | sleep 15 | 12 | sleep 15 |
13 | ${SSH} -F $OBJ/ssh_config somehost true | 13 | ${SSH} -F $OBJ/ssh_config somehost true |
14 | if [ $? -ne 0 ]; then | 14 | if [ $? -ne 0 ]; then |
@@ -21,7 +21,7 @@ trace "test login grace without privsep" | |||
21 | echo "UsePrivilegeSeparation no" >> $OBJ/sshd_config | 21 | echo "UsePrivilegeSeparation no" >> $OBJ/sshd_config |
22 | start_sshd | 22 | start_sshd |
23 | 23 | ||
24 | (echo SSH-2.0-fake; sleep 60) | telnet localhost ${PORT} >/dev/null 2>&1 & | 24 | (echo SSH-2.0-fake; sleep 60) | telnet 127.0.0.1 ${PORT} >/dev/null 2>&1 & |
25 | sleep 15 | 25 | sleep 15 |
26 | ${SSH} -F $OBJ/ssh_config somehost true | 26 | ${SSH} -F $OBJ/ssh_config somehost true |
27 | if [ $? -ne 0 ]; then | 27 | if [ $? -ne 0 ]; then |
diff --git a/regress/multiplex.sh b/regress/multiplex.sh index dbf2025be..e8cc1ac53 100644 --- a/regress/multiplex.sh +++ b/regress/multiplex.sh | |||
@@ -1,17 +1,28 @@ | |||
1 | # $OpenBSD: multiplex.sh,v 1.8 2004/06/22 03:12:13 markus Exp $ | 1 | # $OpenBSD: multiplex.sh,v 1.10 2005/02/27 11:33:30 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | CTL=$OBJ/ctl-sock | 4 | CTL=$OBJ/ctl-sock |
5 | 5 | ||
6 | tid="connection multiplexing" | 6 | tid="connection multiplexing" |
7 | 7 | ||
8 | if grep "#define.*DISABLE_FD_PASSING" ${BUILDDIR}/config.h >/dev/null 2>&1 | ||
9 | then | ||
10 | echo "skipped (not supported on this platform)" | ||
11 | exit 0 | ||
12 | fi | ||
13 | |||
8 | DATA=/bin/ls${EXEEXT} | 14 | DATA=/bin/ls${EXEEXT} |
9 | COPY=$OBJ/ls.copy | 15 | COPY=$OBJ/ls.copy |
16 | LOG=$TEST_SSH_LOGFILE | ||
10 | 17 | ||
11 | start_sshd | 18 | start_sshd |
12 | 19 | ||
13 | trace "start master, fork to background" | 20 | trace "start master, fork to background" |
14 | ${SSH} -2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" -f somehost sleep 120 | 21 | ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & |
22 | MASTER_PID=$! | ||
23 | |||
24 | # Wait for master to start and authenticate | ||
25 | sleep 5 | ||
15 | 26 | ||
16 | verbose "test $tid: envpass" | 27 | verbose "test $tid: envpass" |
17 | trace "env passing over multiplexed connection" | 28 | trace "env passing over multiplexed connection" |
@@ -38,13 +49,13 @@ cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}" | |||
38 | rm -f ${COPY} | 49 | rm -f ${COPY} |
39 | trace "sftp transfer over multiplexed connection and check result" | 50 | trace "sftp transfer over multiplexed connection and check result" |
40 | echo "get ${DATA} ${COPY}" | \ | 51 | echo "get ${DATA} ${COPY}" | \ |
41 | ${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >/dev/null 2>&1 | 52 | ${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >$LOG 2>&1 |
42 | test -f ${COPY} || fail "sftp: failed copy ${DATA}" | 53 | test -f ${COPY} || fail "sftp: failed copy ${DATA}" |
43 | cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}" | 54 | cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}" |
44 | 55 | ||
45 | rm -f ${COPY} | 56 | rm -f ${COPY} |
46 | trace "scp transfer over multiplexed connection and check result" | 57 | trace "scp transfer over multiplexed connection and check result" |
47 | ${SCP} -S ${SSH} -oControlPath=$CTL otherhost:${DATA} ${COPY} >/dev/null 2>&1 | 58 | ${SCP} -S ${SSH} -oControlPath=$CTL otherhost:${DATA} ${COPY} >$LOG 2>&1 |
48 | test -f ${COPY} || fail "scp: failed copy ${DATA}" | 59 | test -f ${COPY} || fail "scp: failed copy ${DATA}" |
49 | cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" | 60 | cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" |
50 | 61 | ||
@@ -69,6 +80,15 @@ for s in 0 1 4 5 44; do | |||
69 | fi | 80 | fi |
70 | done | 81 | done |
71 | 82 | ||
72 | # kill master, remove control socket. ssh -MS will exit when sleep exits | 83 | trace "test check command" |
73 | $SUDO kill `cat $PIDFILE` | 84 | ${SSH} -S $CTL -Ocheck otherhost || fail "check command failed" |
74 | rm -f $CTL | 85 | |
86 | trace "test exit command" | ||
87 | ${SSH} -S $CTL -Oexit otherhost || fail "send exit command failed" | ||
88 | |||
89 | # Wait for master to exit | ||
90 | sleep 2 | ||
91 | |||
92 | ps -p $MASTER_PID >/dev/null && fail "exit command failed" | ||
93 | |||
94 | cleanup | ||
diff --git a/regress/reexec.sh b/regress/reexec.sh index 39fffefbc..d69b8c577 100644 --- a/regress/reexec.sh +++ b/regress/reexec.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: reexec.sh,v 1.3 2004/06/25 01:32:44 djm Exp $ | 1 | # $OpenBSD: reexec.sh,v 1.5 2004/10/08 02:01:50 djm Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="reexec tests" | 4 | tid="reexec tests" |
@@ -6,36 +6,40 @@ tid="reexec tests" | |||
6 | DATA=/bin/ls | 6 | DATA=/bin/ls |
7 | COPY=${OBJ}/copy | 7 | COPY=${OBJ}/copy |
8 | SSHD_ORIG=$SSHD | 8 | SSHD_ORIG=$SSHD |
9 | SSHD_COPY=$OBJ/sshd.copy | 9 | SSHD_COPY=$OBJ/sshd |
10 | 10 | ||
11 | # Start a sshd and then delete it | 11 | # Start a sshd and then delete it |
12 | start_sshd_copy_zap () | 12 | start_sshd_copy () |
13 | { | 13 | { |
14 | cp $SSHD_ORIG $SSHD_COPY | 14 | cp $SSHD_ORIG $SSHD_COPY |
15 | SSHD=$SSHD_COPY | 15 | SSHD=$SSHD_COPY |
16 | start_sshd | 16 | start_sshd |
17 | rm -f $SSHD_COPY | ||
18 | SSHD=$SSHD_ORIG | 17 | SSHD=$SSHD_ORIG |
19 | } | 18 | } |
20 | 19 | ||
20 | # Do basic copy tests | ||
21 | copy_tests () | ||
22 | { | ||
23 | rm -f ${COPY} | ||
24 | for p in 1 2; do | ||
25 | verbose "$tid: proto $p" | ||
26 | ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \ | ||
27 | cat ${DATA} > ${COPY} | ||
28 | if [ $? -ne 0 ]; then | ||
29 | fail "ssh cat $DATA failed" | ||
30 | fi | ||
31 | cmp ${DATA} ${COPY} || fail "corrupted copy" | ||
32 | rm -f ${COPY} | ||
33 | done | ||
34 | } | ||
35 | |||
21 | verbose "test config passing" | 36 | verbose "test config passing" |
22 | cp $OBJ/sshd_config $OBJ/sshd_config.orig | ||
23 | 37 | ||
38 | cp $OBJ/sshd_config $OBJ/sshd_config.orig | ||
24 | start_sshd | 39 | start_sshd |
25 | |||
26 | echo "InvalidXXX=no" >> $OBJ/sshd_config | 40 | echo "InvalidXXX=no" >> $OBJ/sshd_config |
27 | 41 | ||
28 | rm -f ${COPY} | 42 | copy_tests |
29 | for p in 1 2; do | ||
30 | verbose "$tid: proto $p" | ||
31 | ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \ | ||
32 | cat ${DATA} > ${COPY} | ||
33 | if [ $? -ne 0 ]; then | ||
34 | fail "ssh cat $DATA failed" | ||
35 | fi | ||
36 | cmp ${DATA} ${COPY} || fail "corrupted copy" | ||
37 | rm -f ${COPY} | ||
38 | done | ||
39 | 43 | ||
40 | $SUDO kill `cat $PIDFILE` | 44 | $SUDO kill `cat $PIDFILE` |
41 | rm -f $PIDFILE | 45 | rm -f $PIDFILE |
@@ -44,19 +48,10 @@ cp $OBJ/sshd_config.orig $OBJ/sshd_config | |||
44 | 48 | ||
45 | verbose "test reexec fallback" | 49 | verbose "test reexec fallback" |
46 | 50 | ||
47 | start_sshd_copy_zap | 51 | start_sshd_copy |
48 | 52 | rm -f $SSHD_COPY | |
49 | rm -f ${COPY} | 53 | |
50 | for p in 1 2; do | 54 | copy_tests |
51 | verbose "$tid: proto $p" | ||
52 | ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \ | ||
53 | cat ${DATA} > ${COPY} | ||
54 | if [ $? -ne 0 ]; then | ||
55 | fail "ssh cat $DATA failed" | ||
56 | fi | ||
57 | cmp ${DATA} ${COPY} || fail "corrupted copy" | ||
58 | rm -f ${COPY} | ||
59 | done | ||
60 | 55 | ||
61 | $SUDO kill `cat $PIDFILE` | 56 | $SUDO kill `cat $PIDFILE` |
62 | rm -f $PIDFILE | 57 | rm -f $PIDFILE |
@@ -66,22 +61,12 @@ verbose "test reexec fallback without privsep" | |||
66 | cp $OBJ/sshd_config.orig $OBJ/sshd_config | 61 | cp $OBJ/sshd_config.orig $OBJ/sshd_config |
67 | echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config | 62 | echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config |
68 | 63 | ||
69 | start_sshd_copy_zap | 64 | start_sshd_copy |
70 | 65 | rm -f $SSHD_COPY | |
71 | rm -f ${COPY} | 66 | |
72 | for p in 1 2; do | 67 | copy_tests |
73 | verbose "$tid: proto $p" | ||
74 | ${SSH} -nqo "Protocol=$p" -F $OBJ/ssh_config somehost \ | ||
75 | cat ${DATA} > ${COPY} | ||
76 | if [ $? -ne 0 ]; then | ||
77 | fail "ssh cat $DATA failed" | ||
78 | fi | ||
79 | cmp ${DATA} ${COPY} || fail "corrupted copy" | ||
80 | rm -f ${COPY} | ||
81 | done | ||
82 | 68 | ||
83 | $SUDO kill `cat $PIDFILE` | 69 | $SUDO kill `cat $PIDFILE` |
84 | rm -f $PIDFILE | 70 | rm -f $PIDFILE |
85 | 71 | ||
86 | cp $OBJ/sshd_config.orig $OBJ/sshd_config | ||
87 | 72 | ||
diff --git a/regress/rekey.sh b/regress/rekey.sh index 6b7e845ec..3c5f266fc 100644 --- a/regress/rekey.sh +++ b/regress/rekey.sh | |||
@@ -8,6 +8,7 @@ COPY=${OBJ}/copy | |||
8 | LOG=${OBJ}/log | 8 | LOG=${OBJ}/log |
9 | 9 | ||
10 | rm -f ${COPY} ${LOG} ${DATA} | 10 | rm -f ${COPY} ${LOG} ${DATA} |
11 | touch ${DATA} | ||
11 | dd if=/bin/ls${EXEEXT} of=${DATA} bs=1k seek=511 count=1 > /dev/null 2>&1 | 12 | dd if=/bin/ls${EXEEXT} of=${DATA} bs=1k seek=511 count=1 > /dev/null 2>&1 |
12 | 13 | ||
13 | for s in 16 1k 128k 256k; do | 14 | for s in 16 1k 128k 256k; do |
diff --git a/regress/scp.sh b/regress/scp.sh index 703cc0893..c3034b6e7 100644 --- a/regress/scp.sh +++ b/regress/scp.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: scp.sh,v 1.2 2004/06/16 13:15:09 dtucker Exp $ | 1 | # $OpenBSD: scp.sh,v 1.3 2004/07/08 12:59:35 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="scp" | 4 | tid="scp" |
@@ -12,16 +12,16 @@ else | |||
12 | DIFFOPT="-r" | 12 | DIFFOPT="-r" |
13 | fi | 13 | fi |
14 | 14 | ||
15 | DATA=/bin/ls | 15 | DATA=/bin/ls${EXEEXT} |
16 | COPY=${OBJ}/copy | 16 | COPY=${OBJ}/copy |
17 | COPY2=${OBJ}/copy2 | 17 | COPY2=${OBJ}/copy2 |
18 | DIR=${COPY}.dd | 18 | DIR=${COPY}.dd |
19 | DIR2=${COPY}.dd2 | 19 | DIR2=${COPY}.dd2 |
20 | 20 | ||
21 | SRC=`dirname ${SCRIPT}` | 21 | SRC=`dirname ${SCRIPT}` |
22 | cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.exe | 22 | cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp |
23 | chmod 755 ${OBJ}/scp-ssh-wrapper.exe | 23 | chmod 755 ${OBJ}/scp-ssh-wrapper.scp |
24 | scpopts="-q -S ${OBJ}/scp-ssh-wrapper.exe" | 24 | scpopts="-q -S ${OBJ}/scp-ssh-wrapper.scp" |
25 | 25 | ||
26 | scpclean() { | 26 | scpclean() { |
27 | rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} | 27 | rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} |
@@ -64,6 +64,19 @@ cp ${DATA} ${DIR}/copy | |||
64 | $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" | 64 | $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" |
65 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" | 65 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" |
66 | 66 | ||
67 | if [ ! -z "$SUDO" ]; then | ||
68 | verbose "$tid: skipped file after scp -p with failed chown+utimes" | ||
69 | scpclean | ||
70 | cp -p ${DATA} ${DIR}/copy | ||
71 | cp -p ${DATA} ${DIR}/copy2 | ||
72 | cp ${DATA} ${DIR2}/copy | ||
73 | chmod 660 ${DIR2}/copy | ||
74 | $SUDO chown root ${DIR2}/copy | ||
75 | $SCP -p $scpopts somehost:${DIR}/\* ${DIR2} >/dev/null 2>&1 | ||
76 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" | ||
77 | $SUDO rm ${DIR2}/copy | ||
78 | fi | ||
79 | |||
67 | for i in 0 1 2 3 4; do | 80 | for i in 0 1 2 3 4; do |
68 | verbose "$tid: disallow bad server #$i" | 81 | verbose "$tid: disallow bad server #$i" |
69 | SCPTESTMODE=badserver_$i | 82 | SCPTESTMODE=badserver_$i |
@@ -79,4 +92,4 @@ for i in 0 1 2 3 4; do | |||
79 | done | 92 | done |
80 | 93 | ||
81 | scpclean | 94 | scpclean |
82 | rm -f ${OBJ}/scp-ssh-wrapper.exe | 95 | rm -f ${OBJ}/scp-ssh-wrapper.scp |
diff --git a/regress/sftp-glob.sh b/regress/sftp-glob.sh new file mode 100644 index 000000000..e238356a2 --- /dev/null +++ b/regress/sftp-glob.sh | |||
@@ -0,0 +1,28 @@ | |||
1 | # $OpenBSD: sftp-glob.sh,v 1.1 2004/12/10 01:31:30 fgsch Exp $ | ||
2 | # Placed in the Public Domain. | ||
3 | |||
4 | tid="sftp glob" | ||
5 | |||
6 | BASE=${OBJ}/glob | ||
7 | DIR=${BASE}/dir | ||
8 | DATA=${DIR}/file | ||
9 | |||
10 | rm -rf ${BASE} | ||
11 | mkdir -p ${DIR} | ||
12 | touch ${DATA} | ||
13 | |||
14 | verbose "$tid: ls file" | ||
15 | echo "ls -l ${DIR}/fil*" | ${SFTP} -P ${SFTPSERVER} 2>/dev/null | \ | ||
16 | grep ${DATA} >/dev/null 2>&1 | ||
17 | if [ $? -ne 0 ]; then | ||
18 | fail "globbed ls file failed" | ||
19 | fi | ||
20 | |||
21 | verbose "$tid: ls dir" | ||
22 | echo "ls -l ${BASE}/d*" | ${SFTP} -P ${SFTPSERVER} 2>/dev/null | \ | ||
23 | grep file >/dev/null 2>&1 | ||
24 | if [ $? -ne 0 ]; then | ||
25 | fail "globbed ls dir failed" | ||
26 | fi | ||
27 | |||
28 | rm -rf ${BASE} | ||
diff --git a/regress/sshd-log-wrapper.sh b/regress/sshd-log-wrapper.sh new file mode 100644 index 000000000..c7a5ef3a6 --- /dev/null +++ b/regress/sshd-log-wrapper.sh | |||
@@ -0,0 +1,13 @@ | |||
1 | #!/bin/sh | ||
2 | # $OpenBSD: sshd-log-wrapper.sh,v 1.2 2005/02/27 11:40:30 dtucker Exp $ | ||
3 | # Placed in the Public Domain. | ||
4 | # | ||
5 | # simple wrapper for sshd proxy mode to catch stderr output | ||
6 | # sh sshd-log-wrapper.sh /path/to/sshd /path/to/logfile | ||
7 | |||
8 | sshd=$1 | ||
9 | log=$2 | ||
10 | shift | ||
11 | shift | ||
12 | |||
13 | exec $sshd $@ -e 2>>$log | ||
diff --git a/regress/test-exec.sh b/regress/test-exec.sh index 70250acd7..4e53449be 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh | |||
@@ -1,8 +1,19 @@ | |||
1 | # $OpenBSD: test-exec.sh,v 1.23 2004/06/25 01:25:12 djm Exp $ | 1 | # $OpenBSD: test-exec.sh,v 1.27 2005/02/27 11:33:30 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | #SUDO=sudo | 4 | #SUDO=sudo |
5 | 5 | ||
6 | # Unbreak GNU head(1) | ||
7 | _POSIX2_VERSION=199209 | ||
8 | export _POSIX2_VERSION | ||
9 | |||
10 | case `uname -s 2>/dev/null` in | ||
11 | OSF1*) | ||
12 | BIN_SH=xpg4 | ||
13 | export BIN_SH | ||
14 | ;; | ||
15 | esac | ||
16 | |||
6 | if [ ! -z "$TEST_SSH_PORT" ]; then | 17 | if [ ! -z "$TEST_SSH_PORT" ]; then |
7 | PORT="$TEST_SSH_PORT" | 18 | PORT="$TEST_SSH_PORT" |
8 | else | 19 | else |
@@ -43,6 +54,8 @@ else | |||
43 | fi | 54 | fi |
44 | unset SSH_AUTH_SOCK | 55 | unset SSH_AUTH_SOCK |
45 | 56 | ||
57 | SRC=`dirname ${SCRIPT}` | ||
58 | |||
46 | # defaults | 59 | # defaults |
47 | SSH=ssh | 60 | SSH=ssh |
48 | SSHD=sshd | 61 | SSHD=sshd |
@@ -83,7 +96,13 @@ if [ "x$TEST_SSH_SCP" != "x" ]; then | |||
83 | fi | 96 | fi |
84 | 97 | ||
85 | # Path to sshd must be absolute for rexec | 98 | # Path to sshd must be absolute for rexec |
86 | SSHD=`which sshd` | 99 | if [ ! -x /$SSHD ]; then |
100 | SSHD=`which sshd` | ||
101 | fi | ||
102 | |||
103 | if [ "x$TEST_SSH_LOGFILE" = "x" ]; then | ||
104 | TEST_SSH_LOGFILE=/dev/null | ||
105 | fi | ||
87 | 106 | ||
88 | # these should be used in tests | 107 | # these should be used in tests |
89 | export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP | 108 | export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP |
@@ -134,6 +153,7 @@ cleanup () | |||
134 | 153 | ||
135 | trace () | 154 | trace () |
136 | { | 155 | { |
156 | echo "trace: $@" >>$TEST_SSH_LOGFILE | ||
137 | if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then | 157 | if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then |
138 | echo "$@" | 158 | echo "$@" |
139 | fi | 159 | fi |
@@ -141,6 +161,7 @@ trace () | |||
141 | 161 | ||
142 | verbose () | 162 | verbose () |
143 | { | 163 | { |
164 | echo "verbose: $@" >>$TEST_SSH_LOGFILE | ||
144 | if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then | 165 | if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then |
145 | echo "$@" | 166 | echo "$@" |
146 | fi | 167 | fi |
@@ -149,12 +170,14 @@ verbose () | |||
149 | 170 | ||
150 | fail () | 171 | fail () |
151 | { | 172 | { |
173 | echo "FAIL: $@" >>$TEST_SSH_LOGFILE | ||
152 | RESULT=1 | 174 | RESULT=1 |
153 | echo "$@" | 175 | echo "$@" |
154 | } | 176 | } |
155 | 177 | ||
156 | fatal () | 178 | fatal () |
157 | { | 179 | { |
180 | echo "FATAL: $@" >>$TEST_SSH_LOGFILE | ||
158 | echon "FATAL: " | 181 | echon "FATAL: " |
159 | fail "$@" | 182 | fail "$@" |
160 | cleanup | 183 | cleanup |
@@ -174,7 +197,7 @@ cat << EOF > $OBJ/sshd_config | |||
174 | #ListenAddress ::1 | 197 | #ListenAddress ::1 |
175 | PidFile $PIDFILE | 198 | PidFile $PIDFILE |
176 | AuthorizedKeysFile $OBJ/authorized_keys_%u | 199 | AuthorizedKeysFile $OBJ/authorized_keys_%u |
177 | LogLevel QUIET | 200 | LogLevel DEBUG |
178 | AcceptEnv _XXX_TEST_* | 201 | AcceptEnv _XXX_TEST_* |
179 | AcceptEnv _XXX_TEST | 202 | AcceptEnv _XXX_TEST |
180 | Subsystem sftp $SFTPSERVER | 203 | Subsystem sftp $SFTPSERVER |
@@ -205,7 +228,6 @@ Host * | |||
205 | ChallengeResponseAuthentication no | 228 | ChallengeResponseAuthentication no |
206 | HostbasedAuthentication no | 229 | HostbasedAuthentication no |
207 | PasswordAuthentication no | 230 | PasswordAuthentication no |
208 | RhostsRSAAuthentication no | ||
209 | BatchMode yes | 231 | BatchMode yes |
210 | StrictHostKeyChecking yes | 232 | StrictHostKeyChecking yes |
211 | EOF | 233 | EOF |
@@ -246,7 +268,7 @@ chmod 644 $OBJ/authorized_keys_$USER | |||
246 | # create a proxy version of the client config | 268 | # create a proxy version of the client config |
247 | ( | 269 | ( |
248 | cat $OBJ/ssh_config | 270 | cat $OBJ/ssh_config |
249 | echo proxycommand ${SUDO} ${SSHD} -i -f $OBJ/sshd_proxy | 271 | echo proxycommand ${SUDO} sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy |
250 | ) > $OBJ/ssh_proxy | 272 | ) > $OBJ/ssh_proxy |
251 | 273 | ||
252 | # check proxy config | 274 | # check proxy config |
@@ -256,7 +278,7 @@ start_sshd () | |||
256 | { | 278 | { |
257 | # start sshd | 279 | # start sshd |
258 | $SUDO ${SSHD} -f $OBJ/sshd_config -t || fatal "sshd_config broken" | 280 | $SUDO ${SSHD} -f $OBJ/sshd_config -t || fatal "sshd_config broken" |
259 | $SUDO ${SSHD} -f $OBJ/sshd_config | 281 | $SUDO ${SSHD} -f $OBJ/sshd_config -e >>$TEST_SSH_LOGFILE 2>&1 |
260 | 282 | ||
261 | trace "wait for sshd" | 283 | trace "wait for sshd" |
262 | i=0; | 284 | i=0; |