]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Move scp path setting to a helper function. The previous
authordtucker@openbsd.org <dtucker@openbsd.org>
Fri, 13 Jan 2023 04:47:34 +0000 (04:47 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 13 Jan 2023 05:02:49 +0000 (16:02 +1100)
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

regress/multiplex.sh
regress/scp-uri.sh
regress/scp.sh
regress/scp3.sh
regress/test-exec.sh

index 2950d955aa3fc88be4d6e4238f751c1da6ca0345..f9c8fc10bd149147b0c712d508e29d74da8381d3 100644 (file)
@@ -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()
index 20ac3c89ec26b1e19bc01cf5c92dc2c66bf1ddc5..eacbd453afdd2333efbf92b649229b7c69efb773 100644 (file)
@@ -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
index 6800fd4839f8232dc3ecf8102c3d2166eb10afea..76c2b2a6bb56060c5bc3549d68b063961f0e0400 100644 (file)
@@ -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
index f71b1567755b7da6f8278fefc8fbe9c8ac6ad0d8..383121f4519e1fae003ef5ca341542ecc20cc685 100644 (file)
@@ -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
index 5a6afac5853480c156ecfa10f06c0ccfa5dc6acc..df43f021404f567acacca18de0acfb8a435d195d 100644 (file)
@@ -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.