diff options
author | djm@openbsd.org <djm@openbsd.org> | 2021-08-03 01:05:24 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2021-08-03 11:15:06 +1000 |
commit | af5d8094d8b755e1daaf2e20ff1dc252800b4c9b (patch) | |
tree | 8ff1bf30791c93821a64854be01cbcf21df2652a /regress/scp-uri.sh | |
parent | e4673b7f67ae7740131a4ecea29a846593049a91 (diff) | |
download | openssh-git-af5d8094d8b755e1daaf2e20ff1dc252800b4c9b.tar.gz |
upstream: regression tests for scp SFTP protocol support; mostly by
Jakub Jelen in GHPR#194 ok markus
OpenBSD-Regress-ID: 36f1458525bcb111741ec8547eaf58b13cddc715
Diffstat (limited to 'regress/scp-uri.sh')
-rw-r--r-- | regress/scp-uri.sh | 82 |
1 files changed, 45 insertions, 37 deletions
diff --git a/regress/scp-uri.sh b/regress/scp-uri.sh index c03d8bbe..faf5095a 100644 --- a/regress/scp-uri.sh +++ b/regress/scp-uri.sh @@ -1,4 +1,4 @@ -# $OpenBSD: scp-uri.sh,v 1.2 2017/12/11 11:41:56 dtucker Exp $ +# $OpenBSD: scp-uri.sh,v 1.3 2021/08/03 01:05:24 djm Exp $ # Placed in the Public Domain. tid="scp-uri" @@ -12,7 +12,6 @@ DIR2=${COPY}.dd2 SRC=`dirname ${SCRIPT}` cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp chmod 755 ${OBJ}/scp-ssh-wrapper.scp -scpopts="-q -S ${OBJ}/scp-ssh-wrapper.scp" export SCP # used in scp-ssh-wrapper.scp scpclean() { @@ -24,47 +23,56 @@ scpclean() { cp $OBJ/ssh_config $OBJ/ssh_config.orig egrep -v '^ +(Port|User) +.*$' $OBJ/ssh_config.orig > $OBJ/ssh_config -verbose "$tid: simple copy local file to remote file" -scpclean -$SCP $scpopts ${DATA} "scp://${USER}@somehost:${PORT}/${COPY}" || fail "copy failed" -cmp ${DATA} ${COPY} || fail "corrupted copy" +for mode in scp sftp ; do + if test $mode = scp ; then + scpopts="-M scp -q -S ${OBJ}/scp-ssh-wrapper.scp" + tag="$tid" + else + scpopts="-M sftp -D ${SFTPSERVER}" + tag="$tid: sftp mode" + fi + verbose "$tag: simple copy local file to remote file" + scpclean + $SCP $scpopts ${DATA} "scp://${USER}@somehost:${PORT}/${COPY}" || fail "copy failed" + cmp ${DATA} ${COPY} || fail "corrupted copy" -verbose "$tid: simple copy remote file to local file" -scpclean -$SCP $scpopts "scp://${USER}@somehost:${PORT}/${DATA}" ${COPY} || fail "copy failed" -cmp ${DATA} ${COPY} || fail "corrupted copy" + verbose "$tag: simple copy remote file to local file" + scpclean + $SCP $scpopts "scp://${USER}@somehost:${PORT}/${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} "scp://${USER}@somehost:${PORT}/${DIR}" || fail "copy failed" -cmp ${COPY} ${DIR}/copy || fail "corrupted copy" + verbose "$tag: simple copy local file to remote dir" + scpclean + cp ${DATA} ${COPY} + $SCP $scpopts ${COPY} "scp://${USER}@somehost:${PORT}/${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 "scp://${USER}@somehost:${PORT}/${COPY}" ${DIR} || fail "copy failed" -cmp ${COPY} ${DIR}/copy || fail "corrupted copy" + verbose "$tag: simple copy remote file to local dir" + scpclean + cp ${DATA} ${COPY} + $SCP $scpopts "scp://${USER}@somehost:${PORT}/${COPY}" ${DIR} || fail "copy failed" + cmp ${COPY} ${DIR}/copy || fail "corrupted copy" -verbose "$tid: recursive local dir to remote dir" -scpclean -rm -rf ${DIR2} -cp ${DATA} ${DIR}/copy -$SCP $scpopts -r ${DIR} "scp://${USER}@somehost:${PORT}/${DIR2}" || fail "copy failed" -for i in $(cd ${DIR} && echo *); do - cmp ${DIR}/$i ${DIR2}/$i || fail "corrupted copy" -done + verbose "$tag: recursive local dir to remote dir" + scpclean + rm -rf ${DIR2} + cp ${DATA} ${DIR}/copy + $SCP $scpopts -r ${DIR} "scp://${USER}@somehost:${PORT}/${DIR2}" || fail "copy failed" + for i in $(cd ${DIR} && echo *); do + cmp ${DIR}/$i ${DIR2}/$i || fail "corrupted copy" + done -verbose "$tid: recursive remote dir to local dir" -scpclean -rm -rf ${DIR2} -cp ${DATA} ${DIR}/copy -$SCP $scpopts -r "scp://${USER}@somehost:${PORT}/${DIR}" ${DIR2} || fail "copy failed" -for i in $(cd ${DIR} && echo *); do - cmp ${DIR}/$i ${DIR2}/$i || fail "corrupted copy" -done + verbose "$tag: recursive remote dir to local dir" + scpclean + rm -rf ${DIR2} + cp ${DATA} ${DIR}/copy + $SCP $scpopts -r "scp://${USER}@somehost:${PORT}/${DIR}" ${DIR2} || fail "copy failed" + for i in $(cd ${DIR} && echo *); do + cmp ${DIR}/$i ${DIR2}/$i || fail "corrupted copy" + done -# TODO: scp -3 + # TODO: scp -3 +done scpclean rm -f ${OBJ}/scp-ssh-wrapper.exe |