]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Append pid to temp files in /var/run and set a cleanup
authordtucker@openbsd.org <dtucker@openbsd.org>
Thu, 22 Nov 2018 08:48:32 +0000 (08:48 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Thu, 22 Nov 2018 09:58:27 +0000 (20:58 +1100)
trap for them. This allows multiple instances of tests to run without
colliding.

OpenBSD-Regress-ID: 57add105ecdfc54752d8003acdd99eb68c3e0b4c

regress/Makefile
regress/keys-command.sh
regress/principals-command.sh
regress/sftp-chroot.sh

index 647b4a049be3a1740e69ce02e00027458a296fb8..c733dcbd9ad52cd2d539a254aeb11d8c646f87f6 100644 (file)
@@ -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 $
 
 REGRESS_TARGETS=       unit t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t-exec
 tests:         prep $(REGRESS_TARGETS)
@@ -122,8 +122,6 @@ CLEANFILES= *.core actual agent-key.* authorized_keys_${USERNAME} \
                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"
 
index 4029e2c786376bc9192c832e2c30932a610c8718..d166fc589d7175a3bd54e47fe2c493d65e4c803b 100644 (file)
@@ -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"
@@ -19,7 +19,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
@@ -78,5 +79,3 @@ if [ -x $KEY_COMMAND ]; then
 else
        echo "SKIPPED: $KEY_COMMAND not executable (/var/run mounted noexec?)"
 fi
-
-$SUDO rm -f $KEY_COMMAND
index 66b5b5bdede217211c01876f1d859e7c3013fae8..197c0002170bed454ae68fc4ec16d624b9d49d9d 100644 (file)
@@ -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"
@@ -30,7 +30,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
index ba5bd1efb30e233e9b0e4f1b1212a4c96cf36508..5acc4d2de4a631e86f97b7c1785180ed57b07c36 100644 (file)
@@ -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"
@@ -28,5 +29,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