summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2023-01-19 07:53:46 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2023-01-19 07:53:46 +0000
commitfc4b608c8d07ce266a6a2948e1c0d47c2ae0b226 (patch)
tree7a3d5b00a9fc3cef1617e97222b4a3d441200ebc
parentde5db5de382f15fa9fc0ce013eb14f01ac6af798 (diff)
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.
-rw-r--r--regress/usr.bin/ssh/reexec.sh10
1 files changed, 7 insertions, 3 deletions
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