diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | regress/Makefile | 7 | ||||
-rw-r--r-- | regress/scp-ssh-wrapper.sh | 54 | ||||
-rw-r--r-- | regress/scp.sh | 73 | ||||
-rw-r--r-- | regress/test-exec.sh | 10 |
5 files changed, 143 insertions, 7 deletions
@@ -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 | ||
11 | 20040615 | 13 | 20040615 |
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 | ||
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) |
@@ -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 | |||
5 | printname () { | ||
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 | ||
20 | shift; shift; shift; shift; shift | ||
21 | |||
22 | BAD="../../../../../../../../../../../../../${DIR}/dotpathdir" | ||
23 | |||
24 | case "$SCPTESTMODE" in | ||
25 | badserver_0) | ||
26 | echo "D0755 0 /${DIR}/rootpathdir" | ||
27 | echo "C755 2 rootpathfile" | ||
28 | echo "X" | ||
29 | ;; | ||
30 | badserver_1) | ||
31 | echo "D0755 0 $BAD" | ||
32 | echo "C755 2 file" | ||
33 | echo "X" | ||
34 | ;; | ||
35 | badserver_2) | ||
36 | echo "D0755 0 $BAD" | ||
37 | echo "C755 2 file" | ||
38 | echo "X" | ||
39 | ;; | ||
40 | badserver_3) | ||
41 | printname $BAD | ||
42 | echo "C755 2 file" | ||
43 | echo "X" | ||
44 | ;; | ||
45 | badserver_4) | ||
46 | printname $BAD | ||
47 | echo "D0755 0 .." | ||
48 | echo "C755 2 file" | ||
49 | echo "X" | ||
50 | ;; | ||
51 | *) | ||
52 | exec $1 | ||
53 | ;; | ||
54 | esac | ||
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 | |||
4 | tid="scp" | ||
5 | |||
6 | #set -x | ||
7 | |||
8 | DATA=/bin/ls | ||
9 | COPY=${OBJ}/copy | ||
10 | COPY2=${OBJ}/copy2 | ||
11 | DIR=${COPY}.dd | ||
12 | DIR2=${COPY}.dd2 | ||
13 | |||
14 | SRC=`dirname ${SCRIPT}` | ||
15 | cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.exe | ||
16 | chmod 755 ${OBJ}/scp-ssh-wrapper.exe | ||
17 | scpopts="-q -S ${OBJ}/scp-ssh-wrapper.exe" | ||
18 | |||
19 | scpclean() { | ||
20 | rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} | ||
21 | mkdir ${DIR} ${DIR2} | ||
22 | } | ||
23 | |||
24 | verbose "$tid: simple copy local file to remote file" | ||
25 | scpclean | ||
26 | $SCP $scpopts ${DATA} somehost:${COPY} || fail "copy failed" | ||
27 | cmp ${DATA} ${COPY} || fail "corrupted copy" | ||
28 | |||
29 | verbose "$tid: simple copy remote file to local file" | ||
30 | scpclean | ||
31 | $SCP $scpopts somehost:${DATA} ${COPY} || fail "copy failed" | ||
32 | cmp ${DATA} ${COPY} || fail "corrupted copy" | ||
33 | |||
34 | verbose "$tid: simple copy local file to remote dir" | ||
35 | scpclean | ||
36 | cp ${DATA} ${COPY} | ||
37 | $SCP $scpopts ${COPY} somehost:${DIR} || fail "copy failed" | ||
38 | cmp ${COPY} ${DIR}/copy || fail "corrupted copy" | ||
39 | |||
40 | verbose "$tid: simple copy remote file to local dir" | ||
41 | scpclean | ||
42 | cp ${DATA} ${COPY} | ||
43 | $SCP $scpopts somehost:${COPY} ${DIR} || fail "copy failed" | ||
44 | cmp ${COPY} ${DIR}/copy || fail "corrupted copy" | ||
45 | |||
46 | verbose "$tid: recursive local dir to remote dir" | ||
47 | scpclean | ||
48 | cp ${DATA} ${DIR}/copy | ||
49 | $SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed" | ||
50 | cmp ${DIR} ${DIR2} || fail "corrupted copy" | ||
51 | |||
52 | verbose "$tid: recursive remote dir to local dir" | ||
53 | scpclean | ||
54 | cp ${DATA} ${DIR}/copy | ||
55 | $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" | ||
56 | cmp ${DIR} ${DIR2} || fail "corrupted copy" | ||
57 | |||
58 | for 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" | ||
70 | done | ||
71 | |||
72 | scpclean | ||
73 | rm -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 | ||
4 | PORT=4242 | 4 | PORT=4242 |
@@ -47,6 +47,7 @@ SSHKEYGEN=ssh-keygen | |||
47 | SSHKEYSCAN=ssh-keyscan | 47 | SSHKEYSCAN=ssh-keyscan |
48 | SFTP=sftp | 48 | SFTP=sftp |
49 | SFTPSERVER=/usr/libexec/openssh/sftp-server | 49 | SFTPSERVER=/usr/libexec/openssh/sftp-server |
50 | SCP=scp | ||
50 | 51 | ||
51 | if [ "x$TEST_SSH_SSH" != "x" ]; then | 52 | if [ "x$TEST_SSH_SSH" != "x" ]; then |
52 | SSH="${TEST_SSH_SSH}" | 53 | SSH="${TEST_SSH_SSH}" |
@@ -72,10 +73,13 @@ fi | |||
72 | if [ "x$TEST_SSH_SFTPSERVER" != "x" ]; then | 73 | if [ "x$TEST_SSH_SFTPSERVER" != "x" ]; then |
73 | SFTPSERVER="${TEST_SSH_SFTPSERVER}" | 74 | SFTPSERVER="${TEST_SSH_SFTPSERVER}" |
74 | fi | 75 | fi |
76 | if [ "x$TEST_SSH_SCP" != "x" ]; then | ||
77 | SCP="${TEST_SSH_SCP}" | ||
78 | fi | ||
75 | 79 | ||
76 | # these should be used in tests | 80 | # these should be used in tests |
77 | export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER | 81 | export 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 |
81 | echon() | 85 | echon() |