From: dtucker Date: Fri, 13 Jan 2023 04:47:34 +0000 (+0000) Subject: Move scp path setting to a helper function. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8dcc14e77464de971383fcedd6f57d92217eafc4;p=openbsd 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. --- diff --git a/regress/usr.bin/ssh/multiplex.sh b/regress/usr.bin/ssh/multiplex.sh index 8982363c6d3..2cd17b1ce5a 100644 --- a/regress/usr.bin/ssh/multiplex.sh +++ b/regress/usr.bin/ssh/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. CTL=$OBJ/ctl-sock @@ -17,6 +17,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/usr.bin/ssh/scp-uri.sh b/regress/usr.bin/ssh/scp-uri.sh index 20ac3c89ec2..eacbd453afd 100644 --- a/regress/usr.bin/ssh/scp-uri.sh +++ b/regress/usr.bin/ssh/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/usr.bin/ssh/scp.sh b/regress/usr.bin/ssh/scp.sh index 442292afe4e..341e760c51c 100644 --- a/regress/usr.bin/ssh/scp.sh +++ b/regress/usr.bin/ssh/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" @@ -12,6 +12,8 @@ COPY3=${OBJ}/copy.glob[123] DIR3=${COPY}.dd.glob[456] DIFFOPT="-rN" +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/usr.bin/ssh/scp3.sh b/regress/usr.bin/ssh/scp3.sh index f71b1567755..383121f4519 100644 --- a/regress/usr.bin/ssh/scp3.sh +++ b/regress/usr.bin/ssh/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/usr.bin/ssh/test-exec.sh b/regress/usr.bin/ssh/test-exec.sh index 8f26b596175..bd3b724d8b6 100644 --- a/regress/usr.bin/ssh/test-exec.sh +++ b/regress/usr.bin/ssh/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 @@ -313,6 +313,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 @@ -332,13 +344,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.