summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2019-07-19 03:45:45 +0000
committerDamien Miller <djm@cvs.openbsd.org>2019-07-19 03:45:45 +0000
commit285ab635b81476ecb254be96a4839816f57c9899 (patch)
treef28ae3d2a1580dc5ba0cd22a2eda3e744e053c6d /regress/usr.bin
parent3b739def41ab6d5088e579f3e71c0623dbcf5ad4 (diff)
add regression tests for scp for out-of-destination path file creation
by Harry Sintonen via Jakub Jelen in bz3007
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/ssh/scp-ssh-wrapper.sh14
-rw-r--r--regress/usr.bin/ssh/scp.sh14
2 files changed, 25 insertions, 3 deletions
diff --git a/regress/usr.bin/ssh/scp-ssh-wrapper.sh b/regress/usr.bin/ssh/scp-ssh-wrapper.sh
index 59f1ff63e6d..7fb21f424eb 100644
--- a/regress/usr.bin/ssh/scp-ssh-wrapper.sh
+++ b/regress/usr.bin/ssh/scp-ssh-wrapper.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: scp-ssh-wrapper.sh,v 1.3 2014/01/26 10:49:17 djm Exp $
+# $OpenBSD: scp-ssh-wrapper.sh,v 1.4 2019/07/19 03:45:44 djm Exp $
# Placed in the Public Domain.
printname () {
@@ -51,6 +51,18 @@ badserver_4)
echo "C755 2 file"
echo "X"
;;
+badserver_5)
+ echo "D0555 0 "
+ echo "X"
+ ;;
+badserver_6)
+ echo "D0555 0 ."
+ echo "X"
+ ;;
+badserver_7)
+ echo "C0755 2 extrafile"
+ echo "X"
+ ;;
*)
set -- $arg
shift
diff --git a/regress/usr.bin/ssh/scp.sh b/regress/usr.bin/ssh/scp.sh
index e0d4053f5c2..685983900fd 100644
--- a/regress/usr.bin/ssh/scp.sh
+++ b/regress/usr.bin/ssh/scp.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: scp.sh,v 1.10 2014/01/26 10:49:17 djm Exp $
+# $OpenBSD: scp.sh,v 1.11 2019/07/19 03:45:44 djm Exp $
# Placed in the Public Domain.
tid="scp"
@@ -18,6 +18,7 @@ export SCP # used in scp-ssh-wrapper.scp
scpclean() {
rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2}
mkdir ${DIR} ${DIR2}
+ chmod 755 ${DIR} ${DIR2}
}
verbose "$tid: simple copy local file to local file"
@@ -94,7 +95,7 @@ if [ ! -z "$SUDO" ]; then
$SUDO rm ${DIR2}/copy
fi
-for i in 0 1 2 3 4; do
+for i in 0 1 2 3 4 5 6 7; do
verbose "$tid: disallow bad server #$i"
SCPTESTMODE=badserver_$i
export DIR SCPTESTMODE
@@ -106,6 +107,15 @@ for i in 0 1 2 3 4; do
scpclean
$SCP -r $scpopts somehost:${DATA} ${DIR2} >/dev/null 2>/dev/null
[ -d ${DIR}/dotpathdir ] && fail "allows dir creation outside of subdir"
+
+ scpclean
+ $SCP -pr $scpopts somehost:${DATA} ${DIR2} >/dev/null 2>/dev/null
+ [ ! -w ${DIR2} ] && fail "allows target root attribute change"
+
+ scpclean
+ $SCP $scpopts somehost:${DATA} ${DIR2} >/dev/null 2>/dev/null
+ [ -e ${DIR2}/extrafile ] && fail "allows unauth object creation"
+ rm -f ${DIR2}/extrafile
done
verbose "$tid: detect non-directory target"