From: dtucker Date: Thu, 19 Jan 2023 07:53:45 +0000 (+0000) Subject: Check if we can copy sshd or need to use sudo to do so during reexec X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=704ff15594c8fdaf81b13a0e607bc063c09e433b;p=openbsd Check if we can copy sshd or need to use sudo to do so during reexec test. Skip test if neither can work. Patch from anton@, tweaks from me. --- diff --git a/regress/usr.bin/ssh/reexec.sh b/regress/usr.bin/ssh/reexec.sh index 52342fe5435..95c0dfdbf61 100644 --- a/regress/usr.bin/ssh/reexec.sh +++ b/regress/usr.bin/ssh/reexec.sh @@ -1,4 +1,4 @@ -# $OpenBSD: reexec.sh,v 1.12 2017/08/07 03:52:55 dtucker Exp $ +# $OpenBSD: reexec.sh,v 1.13 2023/01/19 07:53:45 dtucker Exp $ # Placed in the Public Domain. tid="reexec tests" @@ -9,7 +9,11 @@ SSHD_COPY=$OBJ/sshd # Start a sshd and then delete it start_sshd_copy () { - cp $SSHD_ORIG $SSHD_COPY + if [ -r "$SSHD_ORIG" ]; then + cp "$SSHD_ORIG" "$SSHD_COPY" + elif [ -z "$SUDO" ] || ! $SUDO cp "$SSHD_ORIG" "$SSHD_COPY"; then + skip "Cannot copy sshd." + fi SSHD=$SSHD_COPY start_sshd SSHD=$SSHD_ORIG @@ -43,7 +47,7 @@ cp $OBJ/sshd_config.orig $OBJ/sshd_config verbose "test reexec fallback" start_sshd_copy -rm -f $SSHD_COPY +$SUDO rm -f $SSHD_COPY copy_tests