summaryrefslogtreecommitdiff
path: root/regress/usr.bin
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2018-11-22 08:48:33 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2018-11-22 08:48:33 +0000
commitadfa351c2d0483023b8449de2829923f901b2d50 (patch)
tree39b8274e941c1ff34196b288800459f7336b6aca /regress/usr.bin
parentcac05a17b83e72ff2da6a19bb5a9b4d07d8b4226 (diff)
Append pid to temp files in /var/run and set a cleanup trap for them.
This allows multiple instances of tests to run without colliding.
Diffstat (limited to 'regress/usr.bin')
-rw-r--r--regress/usr.bin/ssh/Makefile4
-rw-r--r--regress/usr.bin/ssh/keys-command.sh7
-rw-r--r--regress/usr.bin/ssh/principals-command.sh5
-rw-r--r--regress/usr.bin/ssh/sftp-chroot.sh7
4 files changed, 10 insertions, 13 deletions
diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile
index 0ec2546e2ed..a68ea58dde7 100644
--- a/regress/usr.bin/ssh/Makefile
+++ b/regress/usr.bin/ssh/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.97 2018/06/07 04:46:34 djm Exp $
+# $OpenBSD: Makefile,v 1.98 2018/11/22 08:48:32 dtucker Exp $
.ifndef SKIP_UNIT
SUBDIR= unittests
@@ -108,8 +108,6 @@ CLEANFILES+= *.core actual agent-key.* authorized_keys_${USERNAME} \
t6.out1 t6.out2 t7.out t7.out.pub t8.out t8.out.pub \
t9.out t9.out.pub testdata user_*key* user_ca* user_key*
-SUDO_CLEAN+= /var/run/testdata_${USERNAME} /var/run/keycommand_${USERNAME}
-
# Enable all malloc(3) randomisations and checks
TEST_ENV= "MALLOC_OPTIONS=CFGJRSUX"
diff --git a/regress/usr.bin/ssh/keys-command.sh b/regress/usr.bin/ssh/keys-command.sh
index 83a78d097ed..0368f0c1f38 100644
--- a/regress/usr.bin/ssh/keys-command.sh
+++ b/regress/usr.bin/ssh/keys-command.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: keys-command.sh,v 1.4 2016/09/26 21:34:38 bluhm Exp $
+# $OpenBSD: keys-command.sh,v 1.5 2018/11/22 08:48:32 dtucker Exp $
# Placed in the Public Domain.
tid="authorized keys from command"
@@ -17,7 +17,8 @@ expected_key_fp=`$SSHKEYGEN -lf $OBJ/rsa.pub | awk '{ print $2 }'`
# Establish a AuthorizedKeysCommand in /var/run where it will have
# acceptable directory permissions.
-KEY_COMMAND="/var/run/keycommand_${LOGNAME}"
+KEY_COMMAND="/var/run/keycommand_${LOGNAME}.$$"
+trap "${SUDO} rm -f ${KEY_COMMAND}" 0
cat << _EOF | $SUDO sh -c "rm -f '$KEY_COMMAND' ; cat > '$KEY_COMMAND'"
#!/bin/sh
echo args: "\$@" >> $OBJ/keys-command-args
@@ -70,5 +71,3 @@ if [ -x $KEY_COMMAND ]; then
else
echo "SKIPPED: $KEY_COMMAND not executable (/var/run mounted noexec?)"
fi
-
-$SUDO rm -f $KEY_COMMAND
diff --git a/regress/usr.bin/ssh/principals-command.sh b/regress/usr.bin/ssh/principals-command.sh
index adfcd82164d..abf511fceb7 100644
--- a/regress/usr.bin/ssh/principals-command.sh
+++ b/regress/usr.bin/ssh/principals-command.sh
@@ -1,4 +1,4 @@
-# $OpenBSD: principals-command.sh,v 1.5 2018/10/31 11:09:27 dtucker Exp $
+# $OpenBSD: principals-command.sh,v 1.6 2018/11/22 08:48:32 dtucker Exp $
# Placed in the Public Domain.
tid="authorized principals command"
@@ -28,7 +28,8 @@ CA_FP=`${SSHKEYGEN} -lf $OBJ/user_ca_key.pub | awk '{ print $2 }'`
# Establish a AuthorizedPrincipalsCommand in /var/run where it will have
# acceptable directory permissions.
-PRINCIPALS_COMMAND="/var/run/principals_command_${LOGNAME}"
+PRINCIPALS_COMMAND="/var/run/principals_command_${LOGNAME}.$$"
+trap "$SUDO rm -f ${PRINCIPALS_COMMAND}" 0
cat << _EOF | $SUDO sh -c "cat > '$PRINCIPALS_COMMAND'"
#!/bin/sh
test "x\$1" != "x${LOGNAME}" && exit 1
diff --git a/regress/usr.bin/ssh/sftp-chroot.sh b/regress/usr.bin/ssh/sftp-chroot.sh
index 2284765f55a..e399d5f1b1a 100644
--- a/regress/usr.bin/ssh/sftp-chroot.sh
+++ b/regress/usr.bin/ssh/sftp-chroot.sh
@@ -1,11 +1,12 @@
-# $OpenBSD: sftp-chroot.sh,v 1.6 2018/02/09 03:42:57 dtucker Exp $
+# $OpenBSD: sftp-chroot.sh,v 1.7 2018/11/22 08:48:32 dtucker Exp $
# Placed in the Public Domain.
tid="sftp in chroot"
CHROOT=/var/run
-FILENAME=testdata_${USER}
+FILENAME=testdata_${USER}.$$
PRIVDATA=${CHROOT}/${FILENAME}
+trap "${SUDO} rm -f ${PRIVDATA}" 0
if [ -z "$SUDO" -a ! -w /var/run ]; then
echo "need SUDO to create file in /var/run, test won't work without"
@@ -23,5 +24,3 @@ ${SFTP} -S "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY \
>>$TEST_REGRESS_LOGFILE 2>&1 || \
fatal "Fetch ${FILENAME} failed"
cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ"
-
-$SUDO rm $PRIVDATA