mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-11-23 18:23:25 +08:00
- dtucker@cvs.openbsd.org 2004/06/13 13:51:02
[regress/Makefile regress/test-exec.sh, added regress/scp-ssh-wrapper.sh regress/scp.sh] Add scp regression test; with & ok markus@
This commit is contained in:
parent
4c37ef08ab
commit
50433a9243
@ -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
|
||||
@ -1232,4 +1234,4 @@
|
||||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||
|
||||
$Id: ChangeLog,v 1.3389 2004/06/16 10:08:56 dtucker Exp $
|
||||
$Id: ChangeLog,v 1.3390 2004/06/16 10:15:59 dtucker Exp $
|
||||
|
@ -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
|
||||
|
||||
|
54
regress/scp-ssh-wrapper.sh
Normal file
54
regress/scp-ssh-wrapper.sh
Normal file
@ -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
|
73
regress/scp.sh
Normal file
73
regress/scp.sh
Normal file
@ -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
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user