]> andersk Git - openssh.git/commitdiff
- dtucker@cvs.openbsd.org 2004/06/13 13:51:02
authordtucker <dtucker>
Wed, 16 Jun 2004 10:15:59 +0000 (10:15 +0000)
committerdtucker <dtucker>
Wed, 16 Jun 2004 10:15:59 +0000 (10:15 +0000)
     [regress/Makefile regress/test-exec.sh, added regress/scp-ssh-wrapper.sh
     regress/scp.sh]
     Add scp regression test; with & ok markus@

ChangeLog
regress/Makefile
regress/scp-ssh-wrapper.sh [new file with mode: 0644]
regress/scp.sh [new file with mode: 0644]
regress/test-exec.sh

index c1a509b61b23001a8adea46fb539de8cc6aa6268..6f28569d77462f2769fe48ff91d8411494fb8df8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,7 +6,9 @@
      [Makefile test-exec.sh]
      regress test for environment passing, SendEnv & AcceptEnv options;
      ok markus@
-
+   - dtucker@cvs.openbsd.org 2004/06/13 13:51:02
+     [Makefile test-exec.sh]
+     Add scp regression test; with & ok markus@
 
 20040615
  - (djm) OpenBSD CVS Sync
index c7e7bb06a0d89079d8f75fd5c40677e33ad03d36..8f15f3b4d8113618a4e1472bd76f4cf3fe8cbe2b 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: Makefile,v 1.28 2004/04/27 09:47:30 djm Exp $
+#      $OpenBSD: Makefile,v 1.29 2004/06/13 13:51:02 dtucker Exp $
 
 REGRESS_TARGETS=       t1 t2 t3 t4 t5 t6 t7 t-exec
 tests:         $(REGRESS_TARGETS)
@@ -29,6 +29,7 @@ LTESTS=       connect \
                agent-ptrace \
                keyscan \
                keygen-change \
+               scp \
                sftp \
                sftp-cmds \
                sftp-badcmds \
@@ -43,7 +44,9 @@ CLEANFILES=   t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
                ssh_config ssh_proxy sshd_config sshd_proxy \
                rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
                rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
-               ls.copy banner.in banner.out empty.in remote_pid
+               ls.copy banner.in banner.out empty.in \
+               scp-ssh-wrapper.exe \
+               remote_pid
 
 #LTESTS +=     ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
 
diff --git a/regress/scp-ssh-wrapper.sh b/regress/scp-ssh-wrapper.sh
new file mode 100644 (file)
index 0000000..8e43147
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+#       $OpenBSD: scp-ssh-wrapper.sh,v 1.1 2004/06/13 13:51:02 dtucker Exp $
+#       Placed in the Public Domain.
+
+printname () {
+       NAME=$1
+       save_IFS=$IFS
+       IFS=/
+       set -- `echo "$NAME"`
+       IFS="$save_IFS"
+       while [ $# -ge 1 ] ; do
+               if [ "x$1" != "x" ]; then
+                       echo "D0755 0 $1"
+               fi
+               shift;
+       done
+}
+
+# discard first 5 args
+shift; shift; shift; shift; shift
+
+BAD="../../../../../../../../../../../../../${DIR}/dotpathdir"
+
+case "$SCPTESTMODE" in
+badserver_0)
+       echo "D0755 0 /${DIR}/rootpathdir"
+       echo "C755 2 rootpathfile"
+       echo "X"
+       ;;
+badserver_1)
+       echo "D0755 0 $BAD"
+       echo "C755 2 file"
+       echo "X"
+       ;;
+badserver_2)
+       echo "D0755 0 $BAD"
+       echo "C755 2 file"
+       echo "X"
+       ;;
+badserver_3)
+       printname $BAD
+       echo "C755 2 file"
+       echo "X"
+       ;;
+badserver_4)
+       printname $BAD
+       echo "D0755 0 .."
+       echo "C755 2 file"
+       echo "X"
+       ;;
+*)
+       exec $1
+       ;;
+esac
diff --git a/regress/scp.sh b/regress/scp.sh
new file mode 100644 (file)
index 0000000..2d722c7
--- /dev/null
@@ -0,0 +1,73 @@
+#      $OpenBSD: scp.sh,v 1.1 2004/06/13 13:51:02 dtucker Exp $
+#      Placed in the Public Domain.
+
+tid="scp"
+
+#set -x
+
+DATA=/bin/ls
+COPY=${OBJ}/copy
+COPY2=${OBJ}/copy2
+DIR=${COPY}.dd
+DIR2=${COPY}.dd2
+
+SRC=`dirname ${SCRIPT}`
+cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.exe
+chmod 755 ${OBJ}/scp-ssh-wrapper.exe
+scpopts="-q -S ${OBJ}/scp-ssh-wrapper.exe"
+
+scpclean() {
+       rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2}
+       mkdir ${DIR} ${DIR2}
+}
+
+verbose "$tid: simple copy local file to remote file"
+scpclean
+$SCP $scpopts ${DATA} somehost:${COPY} || fail "copy failed"
+cmp ${DATA} ${COPY} || fail "corrupted copy"
+
+verbose "$tid: simple copy remote file to local file"
+scpclean
+$SCP $scpopts somehost:${DATA} ${COPY} || fail "copy failed"
+cmp ${DATA} ${COPY} || fail "corrupted copy"
+
+verbose "$tid: simple copy local file to remote dir"
+scpclean
+cp ${DATA} ${COPY}
+$SCP $scpopts ${COPY} somehost:${DIR} || fail "copy failed"
+cmp ${COPY} ${DIR}/copy || fail "corrupted copy"
+
+verbose "$tid: simple copy remote file to local dir"
+scpclean
+cp ${DATA} ${COPY}
+$SCP $scpopts somehost:${COPY} ${DIR} || fail "copy failed"
+cmp ${COPY} ${DIR}/copy || fail "corrupted copy"
+
+verbose "$tid: recursive local dir to remote dir"
+scpclean
+cp ${DATA} ${DIR}/copy
+$SCP $scpopts -r ${DIR} somehost:${DIR2} || fail "copy failed"
+cmp ${DIR} ${DIR2} || fail "corrupted copy"
+
+verbose "$tid: recursive remote dir to local dir"
+scpclean
+cp ${DATA} ${DIR}/copy
+$SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed"
+cmp ${DIR} ${DIR2} || fail "corrupted copy"
+
+for i in 0 1 2 3 4; do
+       verbose "$tid: disallow bad server #$i"
+       SCPTESTMODE=badserver_$i
+       export DIR SCPTESTMODE
+       scpclean
+       $SCP $scpopts somehost:${DATA} ${DIR} >/dev/null 2>/dev/null
+       [ -d {$DIR}/rootpathdir ] && fail "allows dir relative to root dir"
+       [ -d ${DIR}/dotpathdir ] && fail "allows dir creation in non-recursive mode"
+
+       scpclean
+       $SCP -r $scpopts somehost:${DATA} ${DIR2} >/dev/null 2>/dev/null
+       [ -d ${DIR}/dotpathdir ] && fail "allows dir creation outside of subdir"
+done
+
+scpclean
+rm -f ${OBJ}/scp-ssh-wrapper.exe
index a0df0e957c7d84826acb6488100c337b09b623f4..c8827b6312439030d6467fd738dc87587d059112 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: test-exec.sh,v 1.16 2004/04/27 09:47:30 djm Exp $
+#      $OpenBSD: test-exec.sh,v 1.17 2004/06/13 13:51:02 dtucker Exp $
 #      Placed in the Public Domain.
 
 PORT=4242
@@ -47,6 +47,7 @@ SSHKEYGEN=ssh-keygen
 SSHKEYSCAN=ssh-keyscan
 SFTP=sftp
 SFTPSERVER=/usr/libexec/openssh/sftp-server
+SCP=scp
 
 if [ "x$TEST_SSH_SSH" != "x" ]; then
        SSH="${TEST_SSH_SSH}"
@@ -72,10 +73,13 @@ fi
 if [ "x$TEST_SSH_SFTPSERVER" != "x" ]; then
        SFTPSERVER="${TEST_SSH_SFTPSERVER}"
 fi
+if [ "x$TEST_SSH_SCP" != "x" ]; then
+       SCP="${TEST_SSH_SCP}"
+fi
 
 # these should be used in tests
-export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER
-#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER
+export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP
+#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP
 
 # helper
 echon()
This page took 0.064814 seconds and 5 git commands to generate.