summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--regress/Makefile7
-rw-r--r--regress/scp-ssh-wrapper.sh54
-rw-r--r--regress/scp.sh73
-rw-r--r--regress/test-exec.sh10
5 files changed, 143 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 1c6382737..768e09bd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,7 +6,9 @@
6 [Makefile test-exec.sh] 6 [Makefile test-exec.sh]
7 regress test for environment passing, SendEnv & AcceptEnv options; 7 regress test for environment passing, SendEnv & AcceptEnv options;
8 ok markus@ 8 ok markus@
9 9 - dtucker@cvs.openbsd.org 2004/06/13 13:51:02
10 [Makefile test-exec.sh]
11 Add scp regression test; with & ok markus@
10 12
1120040615 1320040615
12 - (djm) OpenBSD CVS Sync 14 - (djm) OpenBSD CVS Sync
@@ -1232,4 +1234,4 @@
1232 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1234 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1233 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1235 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1234 1236
1235$Id: ChangeLog,v 1.3389 2004/06/16 10:08:56 dtucker Exp $ 1237$Id: ChangeLog,v 1.3390 2004/06/16 10:15:59 dtucker Exp $
diff --git a/regress/Makefile b/regress/Makefile
index c7e7bb06a..8f15f3b4d 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.28 2004/04/27 09:47:30 djm Exp $ 1# $OpenBSD: Makefile,v 1.29 2004/06/13 13:51:02 dtucker 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)
@@ -29,6 +29,7 @@ LTESTS= connect \
29 agent-ptrace \ 29 agent-ptrace \
30 keyscan \ 30 keyscan \
31 keygen-change \ 31 keygen-change \
32 scp \
32 sftp \ 33 sftp \
33 sftp-cmds \ 34 sftp-cmds \
34 sftp-badcmds \ 35 sftp-badcmds \
@@ -43,7 +44,9 @@ CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
43 ssh_config ssh_proxy sshd_config sshd_proxy \ 44 ssh_config ssh_proxy sshd_config sshd_proxy \
44 rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \ 45 rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
45 rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \ 46 rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
46 ls.copy banner.in banner.out empty.in remote_pid 47 ls.copy banner.in banner.out empty.in \
48 scp-ssh-wrapper.exe \
49 remote_pid
47 50
48#LTESTS += ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp 51#LTESTS += ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
49 52
diff --git a/regress/scp-ssh-wrapper.sh b/regress/scp-ssh-wrapper.sh
new file mode 100644
index 000000000..8e4314773
--- /dev/null
+++ b/regress/scp-ssh-wrapper.sh
@@ -0,0 +1,54 @@
1#!/bin/sh
2# $OpenBSD: scp-ssh-wrapper.sh,v 1.1 2004/06/13 13:51:02 dtucker Exp $
3# Placed in the Public Domain.
4
5printname () {
6 NAME=$1
7 save_IFS=$IFS
8 IFS=/
9 set -- `echo "$NAME"`
10 IFS="$save_IFS"
11 while [ $# -ge 1 ] ; do
12 if [ "x$1" != "x" ]; then
13 echo "D0755 0 $1"
14 fi
15 shift;
16 done
17}
18
19# discard first 5 args
20shift; shift; shift; shift; shift
21
22BAD="../../../../../../../../../../../../../${DIR}/dotpathdir"
23
24case "$SCPTESTMODE" in
25badserver_0)
26 echo "D0755 0 /${DIR}/rootpathdir"
27 echo "C755 2 rootpathfile"
28 echo "X"
29 ;;
30badserver_1)
31 echo "D0755 0 $BAD"
32 echo "C755 2 file"
33 echo "X"
34 ;;
35badserver_2)
36 echo "D0755 0 $BAD"
37 echo "C755 2 file"
38 echo "X"
39 ;;
40badserver_3)
41 printname $BAD
42 echo "C755 2 file"
43 echo "X"
44 ;;
45badserver_4)
46 printname $BAD
47 echo "D0755 0 .."
48 echo "C755 2 file"
49 echo "X"
50 ;;
51*)
52 exec $1
53 ;;
54esac
diff --git a/regress/scp.sh b/regress/scp.sh
new file mode 100644
index 000000000..2d722c70c
--- /dev/null
+++ b/regress/scp.sh
@@ -0,0 +1,73 @@
1# $OpenBSD: scp.sh,v 1.1 2004/06/13 13:51:02 dtucker Exp $
2# Placed in the Public Domain.
3
4tid="scp"
5
6#set -x
7
8DATA=/bin/ls
9COPY=${OBJ}/copy
10COPY2=${OBJ}/copy2
11DIR=${COPY}.dd
12DIR2=${COPY}.dd2
13
14SRC=`dirname ${SCRIPT}`
15cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.exe
16chmod 755 ${OBJ}/scp-ssh-wrapper.exe
17scpopts="-q -S ${OBJ}/scp-ssh-wrapper.exe"
18
19scpclean() {
20 rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2}
21 mkdir ${DIR} ${DIR2}
22}
23
24verbose "$tid: simple copy local file to remote file"
25scpclean
26$SCP $scpopts ${DATA} somehost:${COPY} || fail "copy failed"
27cmp ${DATA} ${COPY} || fail "corrupted copy"
28
29verbose "$tid: simple copy remote file to local file"
30scpclean
31$SCP $scpopts somehost:${DATA} ${COPY} || fail "copy failed"
32cmp ${DATA} ${COPY} || fail "corrupted copy"
33
34verbose "$tid: simple copy local file to remote dir"
35scpclean
36cp ${DATA} ${COPY}
37$SCP $scpopts ${COPY} somehost:${DIR} || fail "copy failed"
38cmp ${COPY} ${DIR}/copy || fail "corrupted copy"
39
40verbose "$tid: simple copy remote file to local dir"
41scpclean
42cp ${DATA} ${COPY}
43$SCP $scpopts somehost:${COPY} ${DIR} || fail "copy failed"
44cmp ${COPY} ${DIR}/copy || fail "corrupted copy"
45
46verbose "$tid: recursive local dir to remote dir"
47scpclean
48cp ${DATA} ${DIR}/copy
49$SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed"
50cmp ${DIR} ${DIR2} || fail "corrupted copy"
51
52verbose "$tid: recursive remote dir to local dir"
53scpclean
54cp ${DATA} ${DIR}/copy
55$SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed"
56cmp ${DIR} ${DIR2} || fail "corrupted copy"
57
58for i in 0 1 2 3 4; do
59 verbose "$tid: disallow bad server #$i"
60 SCPTESTMODE=badserver_$i
61 export DIR SCPTESTMODE
62 scpclean
63 $SCP $scpopts somehost:${DATA} ${DIR} >/dev/null 2>/dev/null
64 [ -d {$DIR}/rootpathdir ] && fail "allows dir relative to root dir"
65 [ -d ${DIR}/dotpathdir ] && fail "allows dir creation in non-recursive mode"
66
67 scpclean
68 $SCP -r $scpopts somehost:${DATA} ${DIR2} >/dev/null 2>/dev/null
69 [ -d ${DIR}/dotpathdir ] && fail "allows dir creation outside of subdir"
70done
71
72scpclean
73rm -f ${OBJ}/scp-ssh-wrapper.exe
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index a0df0e957..c8827b631 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: test-exec.sh,v 1.16 2004/04/27 09:47:30 djm Exp $ 1# $OpenBSD: test-exec.sh,v 1.17 2004/06/13 13:51:02 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4PORT=4242 4PORT=4242
@@ -47,6 +47,7 @@ SSHKEYGEN=ssh-keygen
47SSHKEYSCAN=ssh-keyscan 47SSHKEYSCAN=ssh-keyscan
48SFTP=sftp 48SFTP=sftp
49SFTPSERVER=/usr/libexec/openssh/sftp-server 49SFTPSERVER=/usr/libexec/openssh/sftp-server
50SCP=scp
50 51
51if [ "x$TEST_SSH_SSH" != "x" ]; then 52if [ "x$TEST_SSH_SSH" != "x" ]; then
52 SSH="${TEST_SSH_SSH}" 53 SSH="${TEST_SSH_SSH}"
@@ -72,10 +73,13 @@ fi
72if [ "x$TEST_SSH_SFTPSERVER" != "x" ]; then 73if [ "x$TEST_SSH_SFTPSERVER" != "x" ]; then
73 SFTPSERVER="${TEST_SSH_SFTPSERVER}" 74 SFTPSERVER="${TEST_SSH_SFTPSERVER}"
74fi 75fi
76if [ "x$TEST_SSH_SCP" != "x" ]; then
77 SCP="${TEST_SSH_SCP}"
78fi
75 79
76# these should be used in tests 80# these should be used in tests
77export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER 81export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP
78#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER 82#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP
79 83
80# helper 84# helper
81echon() 85echon()