upstream: Remove sshd logfile in start_sshd

... and ssh and sshd log wrappers before recreating them.  Prevents "can't
create" errors during tests when running tests without SUDO after having
run them with SUDO.

OpenBSD-Regress-ID: 2f0a83532e3dccd673a9bf0291090277268c69a6
This commit is contained in:
dtucker@openbsd.org 2024-10-22 07:13:28 +00:00 committed by Darren Tucker
parent 307ab3c772
commit 1b05d5437b
No known key found for this signature in database
1 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: test-exec.sh,v 1.120 2024/10/14 03:02:08 djm Exp $ # $OpenBSD: test-exec.sh,v 1.121 2024/10/22 07:13:28 dtucker Exp $
# Placed in the Public Domain. # Placed in the Public Domain.
#SUDO=sudo #SUDO=sudo
@ -309,6 +309,7 @@ fi
# to preserve our debug logging. In the rare instance where -q is desirable # to preserve our debug logging. In the rare instance where -q is desirable
# -qq is equivalent and is not removed. # -qq is equivalent and is not removed.
SSHLOGWRAP=$OBJ/ssh-log-wrapper.sh SSHLOGWRAP=$OBJ/ssh-log-wrapper.sh
rm -f ${SSHLOGWRAP}
cat >$SSHLOGWRAP <<EOD cat >$SSHLOGWRAP <<EOD
#!/bin/sh #!/bin/sh
timestamp="\`$OBJ/timestamp\`" timestamp="\`$OBJ/timestamp\`"
@ -327,6 +328,7 @@ REAL_SSHD="$SSHD"
SSH="$SSHLOGWRAP" SSH="$SSHLOGWRAP"
SSHDLOGWRAP=$OBJ/sshd-log-wrapper.sh SSHDLOGWRAP=$OBJ/sshd-log-wrapper.sh
rm -f ${SSHDLOGWRAP}
cat >$SSHDLOGWRAP <<EOD cat >$SSHDLOGWRAP <<EOD
#!/bin/sh #!/bin/sh
timestamp="\`$OBJ/timestamp\`" timestamp="\`$OBJ/timestamp\`"
@ -903,6 +905,7 @@ start_sshd ()
i=`expr $i + 1` i=`expr $i + 1`
sleep $i sleep $i
done done
rm -f ${TEST_SSHD_LOGFILE}
ln -f -s ${logfile} $TEST_SSHD_LOGFILE ln -f -s ${logfile} $TEST_SSHD_LOGFILE
test -f $PIDFILE || fatal "no sshd running on port $PORT" test -f $PIDFILE || fatal "no sshd running on port $PORT"