mirror of
git://anongit.mindrot.org/openssh.git
synced 2024-12-27 04:12:10 +00:00
ed6b0c5fc2
[sftp-batch.sh sftp-badcmds.sh sftp.sh sftp-cmds.sh sftp-glob.sh] date: 2009/08/13 01:11:19; author: djm; state: Exp; lines: +10 -7 Swizzle options: "-P sftp_server_path" moves to "-D sftp_server_path", add "-P port" to match scp(1). Fortunately, the -P option is only really used by our regression scripts. part of larger patch from carlosvsilvapt@gmail.com for his Google Summer of Code work; ok deraadt markus
58 lines
1.2 KiB
Bash
58 lines
1.2 KiB
Bash
# $OpenBSD: sftp-batch.sh,v 1.4 2009/08/13 01:11:55 djm Exp $
|
|
# Placed in the Public Domain.
|
|
|
|
tid="sftp batchfile"
|
|
|
|
DATA=/bin/ls${EXEEXT}
|
|
COPY=${OBJ}/copy
|
|
BATCH=${OBJ}/sftp.bb
|
|
|
|
rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
|
|
|
|
cat << EOF > ${BATCH}.pass.1
|
|
get $DATA $COPY
|
|
put ${COPY} ${COPY}.1
|
|
rm ${COPY}
|
|
-put ${COPY} ${COPY}.2
|
|
EOF
|
|
|
|
cat << EOF > ${BATCH}.pass.2
|
|
# This is a comment
|
|
|
|
# That was a blank line
|
|
ls
|
|
EOF
|
|
|
|
cat << EOF > ${BATCH}.fail.1
|
|
get $DATA $COPY
|
|
put ${COPY} ${COPY}.3
|
|
rm ${COPY}.*
|
|
# The next command should fail
|
|
put ${COPY}.3 ${COPY}.4
|
|
EOF
|
|
|
|
cat << EOF > ${BATCH}.fail.2
|
|
# The next command should fail
|
|
jajajajaja
|
|
EOF
|
|
|
|
verbose "$tid: good commands"
|
|
${SFTP} -b ${BATCH}.pass.1 -D ${SFTPSERVER} >/dev/null 2>&1 \
|
|
|| fail "good commands failed"
|
|
|
|
verbose "$tid: bad commands"
|
|
${SFTP} -b ${BATCH}.fail.1 -D ${SFTPSERVER} >/dev/null 2>&1 \
|
|
&& fail "bad commands succeeded"
|
|
|
|
verbose "$tid: comments and blanks"
|
|
${SFTP} -b ${BATCH}.pass.2 -D ${SFTPSERVER} >/dev/null 2>&1 \
|
|
|| fail "comments & blanks failed"
|
|
|
|
verbose "$tid: junk command"
|
|
${SFTP} -b ${BATCH}.fail.2 -D ${SFTPSERVER} >/dev/null 2>&1 \
|
|
&& fail "junk command succeeded"
|
|
|
|
rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
|
|
|
|
|