summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2023-01-13 04:47:34 +0000
committerDarren Tucker <dtucker@dtucker.net>2023-01-13 16:02:49 +1100
commit625f6bc39840167dafb3bf5b6a3e18503ac986e8 (patch)
tree818b776bad341bf31959f0a1594b863c5b59ee0f
parent6e6f88647042b3cde54a628545c2f5fb656a9327 (diff)
upstream: Move scp path setting to a helper function. The previous
commit to add scp to the test sshd's path causes the t-envpass test to fail when the test scp is given using a fully qualified path. Put this in a helper function and only call it from the scp tests. OpenBSD-Regress-ID: 7533dc1c4265c1de716abb062957994195b36df4
-rw-r--r--regress/multiplex.sh3
-rw-r--r--regress/scp-uri.sh4
-rw-r--r--regress/scp.sh4
-rw-r--r--regress/scp3.sh6
-rw-r--r--regress/test-exec.sh21
5 files changed, 25 insertions, 13 deletions
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index 2950d955..f9c8fc10 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: multiplex.sh,v 1.34 2022/06/03 04:31:54 djm Exp $
+# $OpenBSD: multiplex.sh,v 1.35 2023/01/13 04:47:34 dtucker Exp $
# Placed in the Public Domain.
make_tmpdir
@@ -24,6 +24,7 @@ wait_for_mux_master_ready()
fatal "mux master never becomes ready"
}
+maybe_add_scp_path_to_sshd
start_sshd
start_mux_master()
diff --git a/regress/scp-uri.sh b/regress/scp-uri.sh
index 20ac3c89..eacbd453 100644
--- a/regress/scp-uri.sh
+++ b/regress/scp-uri.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: scp-uri.sh,v 1.4 2021/08/10 03:35:45 djm Exp $
+# $OpenBSD: scp-uri.sh,v 1.5 2023/01/13 04:47:34 dtucker Exp $
# Placed in the Public Domain.
tid="scp-uri"
@@ -9,6 +9,8 @@ COPY2=${OBJ}/copy2
DIR=${COPY}.dd
DIR2=${COPY}.dd2
+maybe_add_scp_path_to_sshd
+
SRC=`dirname ${SCRIPT}`
cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp
chmod 755 ${OBJ}/scp-ssh-wrapper.scp
diff --git a/regress/scp.sh b/regress/scp.sh
index 6800fd48..76c2b2a6 100644
--- a/regress/scp.sh
+++ b/regress/scp.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: scp.sh,v 1.17 2023/01/06 07:18:18 djm Exp $
+# $OpenBSD: scp.sh,v 1.18 2023/01/13 04:47:34 dtucker Exp $
# Placed in the Public Domain.
tid="scp"
@@ -17,6 +17,8 @@ if ! diff -N ${SRC}/scp.sh ${SRC}/scp.sh 2>/dev/null; then
DIFFOPT="-r"
fi
+maybe_add_scp_path_to_sshd
+
SRC=`dirname ${SCRIPT}`
cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp
chmod 755 ${OBJ}/scp-ssh-wrapper.scp
diff --git a/regress/scp3.sh b/regress/scp3.sh
index f71b1567..383121f4 100644
--- a/regress/scp3.sh
+++ b/regress/scp3.sh
@@ -1,14 +1,16 @@
-# $OpenBSD: scp3.sh,v 1.3 2021/08/10 03:35:45 djm Exp $
+# $OpenBSD: scp3.sh,v 1.4 2023/01/13 04:47:34 dtucker Exp $
# Placed in the Public Domain.
tid="scp3"
-#set -x
+set -x
COPY2=${OBJ}/copy2
DIR=${COPY}.dd
DIR2=${COPY}.dd2
+maybe_add_scp_path_to_sshd
+
SRC=`dirname ${SCRIPT}`
cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp
chmod 755 ${OBJ}/scp-ssh-wrapper.scp
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index 5a6afac5..df43f021 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: test-exec.sh,v 1.93 2023/01/13 04:23:00 dtucker Exp $
+# $OpenBSD: test-exec.sh,v 1.94 2023/01/13 04:47:34 dtucker Exp $
# Placed in the Public Domain.
#SUDO=sudo
@@ -509,6 +509,18 @@ skip ()
exit $RESULT
}
+maybe_add_scp_path_to_sshd ()
+{
+ # If we're testing a non-installed scp, add its directory to sshd's
+ # PATH so we can test it. We don't do this for all tests as it
+ # breaks the SetEnv tests.
+ case "$SCP" in
+ /*) PATH_WITH_SCP="`dirname $SCP`:$PATH"
+ echo " SetEnv PATH='$PATH_WITH_SCP'" >>$OBJ/sshd_config
+ echo " SetEnv PATH='$PATH_WITH_SCP'" >>$OBJ/sshd_proxy ;;
+ esac
+}
+
RESULT=0
PIDFILE=$OBJ/pidfile
@@ -529,13 +541,6 @@ cat << EOF > $OBJ/sshd_config
Subsystem sftp $SFTPSERVER
EOF
-# If we're testing a non-installed scp, add its directory to sshd's PATH
-# so we can test it.
-case "$SCP" in
-/*) PATH_WITH_SCP="`dirname $SCP`:$PATH"
- echo " SetEnv PATH='$PATH_WITH_SCP'" >>$OBJ/sshd_config ;;
-esac
-
# This may be necessary if /usr/src and/or /usr/obj are group-writable,
# but if you aren't careful with permissions then the unit tests could
# be abused to locally escalate privileges.