summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile12
-rw-r--r--regress/agent-ptrace.sh4
-rw-r--r--regress/brokenkeys.sh23
-rw-r--r--regress/dynamic-forward.sh5
-rw-r--r--regress/envpass.sh21
-rw-r--r--regress/login-timeout.sh6
-rw-r--r--regress/multiplex.sh34
-rw-r--r--regress/reexec.sh73
-rw-r--r--regress/rekey.sh1
-rw-r--r--regress/scp.sh25
-rw-r--r--regress/sftp-glob.sh28
-rw-r--r--regress/sshd-log-wrapper.sh13
-rw-r--r--regress/test-exec.sh34
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
3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec 3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec
4tests: $(REGRESS_TARGETS) 4tests: $(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
43USER!= id -un 45USER!= id -un
44CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ 46CLEANFILES= 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
6if have_prog uname ; then 6if 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
4tid="broken keys"
5
6KEYS="$OBJ/authorized_keys_${USER}"
7
8start_sshd
9
10mv ${KEYS} ${KEYS}.bak
11
12# Truncated key
13echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEABTM= bad key" > $KEYS
14cat ${KEYS}.bak >> ${KEYS}
15cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER
16
17${SSH} -2 -F $OBJ/ssh_config somehost true
18if [ $? -ne 0 ]; then
19 fail "ssh connect with protocol $p failed"
20fi
21
22mv ${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
4tid="dynamic forwarding" 4tid="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
47done 50done
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
4tid="environment passing" 4tid="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
9cat << EOF > $OBJ/ssh_proxy_envpass
10Host test-sendenv-confparse-bug
11 SendEnv *
12EOF
13cat $OBJ/ssh_proxy >> $OBJ/ssh_proxy_envpass
14
8trace "pass env, don't accept" 15trace "pass env, don't accept"
9verbose "test $tid: pass env, don't accept" 16verbose "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"
13EOF 20EOF
@@ -18,7 +25,7 @@ fi
18 25
19trace "don't pass env, accept" 26trace "don't pass env, accept"
20verbose "test $tid: don't pass env, accept" 27verbose "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"
24EOF 31EOF
@@ -29,8 +36,8 @@ fi
29 36
30trace "pass single env, accept single env" 37trace "pass single env, accept single env"
31verbose "test $tid: pass single env, accept single env" 38verbose "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"
35EOF 42EOF
36r=$? 43r=$?
@@ -41,7 +48,7 @@ fi
41trace "pass multiple env, accept multiple env" 48trace "pass multiple env, accept multiple env"
42verbose "test $tid: pass multiple env, accept multiple env" 49verbose "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"
47EOF 54EOF
@@ -49,3 +56,5 @@ r=$?
49if [ $r -ne 0 ]; then 56if [ $r -ne 0 ]; then
50 fail "environment not found" 57 fail "environment not found"
51fi 58fi
59
60rm -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
4tid="connect after login grace timeout" 4tid="connect after login grace timeout"
@@ -8,7 +8,7 @@ echo "LoginGraceTime 10s" >> $OBJ/sshd_config
8echo "MaxStartups 1" >> $OBJ/sshd_config 8echo "MaxStartups 1" >> $OBJ/sshd_config
9start_sshd 9start_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 &
12sleep 15 12sleep 15
13${SSH} -F $OBJ/ssh_config somehost true 13${SSH} -F $OBJ/ssh_config somehost true
14if [ $? -ne 0 ]; then 14if [ $? -ne 0 ]; then
@@ -21,7 +21,7 @@ trace "test login grace without privsep"
21echo "UsePrivilegeSeparation no" >> $OBJ/sshd_config 21echo "UsePrivilegeSeparation no" >> $OBJ/sshd_config
22start_sshd 22start_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 &
25sleep 15 25sleep 15
26${SSH} -F $OBJ/ssh_config somehost true 26${SSH} -F $OBJ/ssh_config somehost true
27if [ $? -ne 0 ]; then 27if [ $? -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
4CTL=$OBJ/ctl-sock 4CTL=$OBJ/ctl-sock
5 5
6tid="connection multiplexing" 6tid="connection multiplexing"
7 7
8if grep "#define.*DISABLE_FD_PASSING" ${BUILDDIR}/config.h >/dev/null 2>&1
9then
10 echo "skipped (not supported on this platform)"
11 exit 0
12fi
13
8DATA=/bin/ls${EXEEXT} 14DATA=/bin/ls${EXEEXT}
9COPY=$OBJ/ls.copy 15COPY=$OBJ/ls.copy
16LOG=$TEST_SSH_LOGFILE
10 17
11start_sshd 18start_sshd
12 19
13trace "start master, fork to background" 20trace "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 &
22MASTER_PID=$!
23
24# Wait for master to start and authenticate
25sleep 5
15 26
16verbose "test $tid: envpass" 27verbose "test $tid: envpass"
17trace "env passing over multiplexed connection" 28trace "env passing over multiplexed connection"
@@ -38,13 +49,13 @@ cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}"
38rm -f ${COPY} 49rm -f ${COPY}
39trace "sftp transfer over multiplexed connection and check result" 50trace "sftp transfer over multiplexed connection and check result"
40echo "get ${DATA} ${COPY}" | \ 51echo "get ${DATA} ${COPY}" | \
41 ${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >/dev/null 2>&1 52 ${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >$LOG 2>&1
42test -f ${COPY} || fail "sftp: failed copy ${DATA}" 53test -f ${COPY} || fail "sftp: failed copy ${DATA}"
43cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}" 54cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}"
44 55
45rm -f ${COPY} 56rm -f ${COPY}
46trace "scp transfer over multiplexed connection and check result" 57trace "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
48test -f ${COPY} || fail "scp: failed copy ${DATA}" 59test -f ${COPY} || fail "scp: failed copy ${DATA}"
49cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" 60cmp ${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
70done 81done
71 82
72# kill master, remove control socket. ssh -MS will exit when sleep exits 83trace "test check command"
73$SUDO kill `cat $PIDFILE` 84${SSH} -S $CTL -Ocheck otherhost || fail "check command failed"
74rm -f $CTL 85
86trace "test exit command"
87${SSH} -S $CTL -Oexit otherhost || fail "send exit command failed"
88
89# Wait for master to exit
90sleep 2
91
92ps -p $MASTER_PID >/dev/null && fail "exit command failed"
93
94cleanup
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
4tid="reexec tests" 4tid="reexec tests"
@@ -6,36 +6,40 @@ tid="reexec tests"
6DATA=/bin/ls 6DATA=/bin/ls
7COPY=${OBJ}/copy 7COPY=${OBJ}/copy
8SSHD_ORIG=$SSHD 8SSHD_ORIG=$SSHD
9SSHD_COPY=$OBJ/sshd.copy 9SSHD_COPY=$OBJ/sshd
10 10
11# Start a sshd and then delete it 11# Start a sshd and then delete it
12start_sshd_copy_zap () 12start_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
21copy_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
21verbose "test config passing" 36verbose "test config passing"
22cp $OBJ/sshd_config $OBJ/sshd_config.orig
23 37
38cp $OBJ/sshd_config $OBJ/sshd_config.orig
24start_sshd 39start_sshd
25
26echo "InvalidXXX=no" >> $OBJ/sshd_config 40echo "InvalidXXX=no" >> $OBJ/sshd_config
27 41
28rm -f ${COPY} 42copy_tests
29for 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}
38done
39 43
40$SUDO kill `cat $PIDFILE` 44$SUDO kill `cat $PIDFILE`
41rm -f $PIDFILE 45rm -f $PIDFILE
@@ -44,19 +48,10 @@ cp $OBJ/sshd_config.orig $OBJ/sshd_config
44 48
45verbose "test reexec fallback" 49verbose "test reexec fallback"
46 50
47start_sshd_copy_zap 51start_sshd_copy
48 52rm -f $SSHD_COPY
49rm -f ${COPY} 53
50for p in 1 2; do 54copy_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}
59done
60 55
61$SUDO kill `cat $PIDFILE` 56$SUDO kill `cat $PIDFILE`
62rm -f $PIDFILE 57rm -f $PIDFILE
@@ -66,22 +61,12 @@ verbose "test reexec fallback without privsep"
66cp $OBJ/sshd_config.orig $OBJ/sshd_config 61cp $OBJ/sshd_config.orig $OBJ/sshd_config
67echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config 62echo "UsePrivilegeSeparation=no" >> $OBJ/sshd_config
68 63
69start_sshd_copy_zap 64start_sshd_copy
70 65rm -f $SSHD_COPY
71rm -f ${COPY} 66
72for p in 1 2; do 67copy_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}
81done
82 68
83$SUDO kill `cat $PIDFILE` 69$SUDO kill `cat $PIDFILE`
84rm -f $PIDFILE 70rm -f $PIDFILE
85 71
86cp $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
8LOG=${OBJ}/log 8LOG=${OBJ}/log
9 9
10rm -f ${COPY} ${LOG} ${DATA} 10rm -f ${COPY} ${LOG} ${DATA}
11touch ${DATA}
11dd if=/bin/ls${EXEEXT} of=${DATA} bs=1k seek=511 count=1 > /dev/null 2>&1 12dd if=/bin/ls${EXEEXT} of=${DATA} bs=1k seek=511 count=1 > /dev/null 2>&1
12 13
13for s in 16 1k 128k 256k; do 14for 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
4tid="scp" 4tid="scp"
@@ -12,16 +12,16 @@ else
12 DIFFOPT="-r" 12 DIFFOPT="-r"
13fi 13fi
14 14
15DATA=/bin/ls 15DATA=/bin/ls${EXEEXT}
16COPY=${OBJ}/copy 16COPY=${OBJ}/copy
17COPY2=${OBJ}/copy2 17COPY2=${OBJ}/copy2
18DIR=${COPY}.dd 18DIR=${COPY}.dd
19DIR2=${COPY}.dd2 19DIR2=${COPY}.dd2
20 20
21SRC=`dirname ${SCRIPT}` 21SRC=`dirname ${SCRIPT}`
22cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.exe 22cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp
23chmod 755 ${OBJ}/scp-ssh-wrapper.exe 23chmod 755 ${OBJ}/scp-ssh-wrapper.scp
24scpopts="-q -S ${OBJ}/scp-ssh-wrapper.exe" 24scpopts="-q -S ${OBJ}/scp-ssh-wrapper.scp"
25 25
26scpclean() { 26scpclean() {
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"
65diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" 65diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy"
66 66
67if [ ! -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
78fi
79
67for i in 0 1 2 3 4; do 80for 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
79done 92done
80 93
81scpclean 94scpclean
82rm -f ${OBJ}/scp-ssh-wrapper.exe 95rm -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
4tid="sftp glob"
5
6BASE=${OBJ}/glob
7DIR=${BASE}/dir
8DATA=${DIR}/file
9
10rm -rf ${BASE}
11mkdir -p ${DIR}
12touch ${DATA}
13
14verbose "$tid: ls file"
15echo "ls -l ${DIR}/fil*" | ${SFTP} -P ${SFTPSERVER} 2>/dev/null | \
16 grep ${DATA} >/dev/null 2>&1
17if [ $? -ne 0 ]; then
18 fail "globbed ls file failed"
19fi
20
21verbose "$tid: ls dir"
22echo "ls -l ${BASE}/d*" | ${SFTP} -P ${SFTPSERVER} 2>/dev/null | \
23 grep file >/dev/null 2>&1
24if [ $? -ne 0 ]; then
25 fail "globbed ls dir failed"
26fi
27
28rm -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
8sshd=$1
9log=$2
10shift
11shift
12
13exec $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
8export _POSIX2_VERSION
9
10case `uname -s 2>/dev/null` in
11OSF1*)
12 BIN_SH=xpg4
13 export BIN_SH
14 ;;
15esac
16
6if [ ! -z "$TEST_SSH_PORT" ]; then 17if [ ! -z "$TEST_SSH_PORT" ]; then
7 PORT="$TEST_SSH_PORT" 18 PORT="$TEST_SSH_PORT"
8else 19else
@@ -43,6 +54,8 @@ else
43fi 54fi
44unset SSH_AUTH_SOCK 55unset SSH_AUTH_SOCK
45 56
57SRC=`dirname ${SCRIPT}`
58
46# defaults 59# defaults
47SSH=ssh 60SSH=ssh
48SSHD=sshd 61SSHD=sshd
@@ -83,7 +96,13 @@ if [ "x$TEST_SSH_SCP" != "x" ]; then
83fi 96fi
84 97
85# Path to sshd must be absolute for rexec 98# Path to sshd must be absolute for rexec
86SSHD=`which sshd` 99if [ ! -x /$SSHD ]; then
100 SSHD=`which sshd`
101fi
102
103if [ "x$TEST_SSH_LOGFILE" = "x" ]; then
104 TEST_SSH_LOGFILE=/dev/null
105fi
87 106
88# these should be used in tests 107# these should be used in tests
89export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP 108export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP
@@ -134,6 +153,7 @@ cleanup ()
134 153
135trace () 154trace ()
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
142verbose () 162verbose ()
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
150fail () 171fail ()
151{ 172{
173 echo "FAIL: $@" >>$TEST_SSH_LOGFILE
152 RESULT=1 174 RESULT=1
153 echo "$@" 175 echo "$@"
154} 176}
155 177
156fatal () 178fatal ()
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
211EOF 233EOF
@@ -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;