diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2018-11-22 08:48:32 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2018-11-22 20:58:27 +1100 |
commit | e4ae345dc75b34fd870c2e8690d831d2c1088eb7 (patch) | |
tree | 3f48b32dd7835a20f41a5b5f26ba9a05207e18e0 | |
parent | f72d0f52effca5aa20a193217346615ecd3eed53 (diff) |
upstream: 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.
OpenBSD-Regress-ID: 57add105ecdfc54752d8003acdd99eb68c3e0b4c
-rw-r--r-- | regress/Makefile | 4 | ||||
-rw-r--r-- | regress/keys-command.sh | 7 | ||||
-rw-r--r-- | regress/principals-command.sh | 5 | ||||
-rw-r--r-- | regress/sftp-chroot.sh | 7 |
4 files changed, 10 insertions, 13 deletions
diff --git a/regress/Makefile b/regress/Makefile index 647b4a049..c733dcbd9 100644 --- a/regress/Makefile +++ b/regress/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.97 2018/06/07 04:46:34 djm Exp $ | 1 | # $OpenBSD: Makefile,v 1.98 2018/11/22 08:48:32 dtucker Exp $ |
2 | 2 | ||
3 | REGRESS_TARGETS= unit t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t-exec | 3 | REGRESS_TARGETS= unit t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t-exec |
4 | tests: prep $(REGRESS_TARGETS) | 4 | tests: prep $(REGRESS_TARGETS) |
@@ -122,8 +122,6 @@ CLEANFILES= *.core actual agent-key.* authorized_keys_${USERNAME} \ | |||
122 | t8.out t8.out.pub t9.out t9.out.pub testdata \ | 122 | t8.out t8.out.pub t9.out t9.out.pub testdata \ |
123 | user_*key* user_ca* user_key* | 123 | user_*key* user_ca* user_key* |
124 | 124 | ||
125 | SUDO_CLEAN+= /var/run/testdata_${USERNAME} /var/run/keycommand_${USERNAME} | ||
126 | |||
127 | # Enable all malloc(3) randomisations and checks | 125 | # Enable all malloc(3) randomisations and checks |
128 | TEST_ENV= "MALLOC_OPTIONS=CFGJRSUX" | 126 | TEST_ENV= "MALLOC_OPTIONS=CFGJRSUX" |
129 | 127 | ||
diff --git a/regress/keys-command.sh b/regress/keys-command.sh index 4029e2c78..d166fc589 100644 --- a/regress/keys-command.sh +++ b/regress/keys-command.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: keys-command.sh,v 1.4 2016/09/26 21:34:38 bluhm Exp $ | 1 | # $OpenBSD: keys-command.sh,v 1.5 2018/11/22 08:48:32 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="authorized keys from command" | 4 | tid="authorized keys from command" |
@@ -19,7 +19,8 @@ expected_key_fp=`$SSHKEYGEN -lf $OBJ/rsa.pub | awk '{ print $2 }'` | |||
19 | 19 | ||
20 | # Establish a AuthorizedKeysCommand in /var/run where it will have | 20 | # Establish a AuthorizedKeysCommand in /var/run where it will have |
21 | # acceptable directory permissions. | 21 | # acceptable directory permissions. |
22 | KEY_COMMAND="/var/run/keycommand_${LOGNAME}" | 22 | KEY_COMMAND="/var/run/keycommand_${LOGNAME}.$$" |
23 | trap "${SUDO} rm -f ${KEY_COMMAND}" 0 | ||
23 | cat << _EOF | $SUDO sh -c "rm -f '$KEY_COMMAND' ; cat > '$KEY_COMMAND'" | 24 | cat << _EOF | $SUDO sh -c "rm -f '$KEY_COMMAND' ; cat > '$KEY_COMMAND'" |
24 | #!/bin/sh | 25 | #!/bin/sh |
25 | echo args: "\$@" >> $OBJ/keys-command-args | 26 | echo args: "\$@" >> $OBJ/keys-command-args |
@@ -78,5 +79,3 @@ if [ -x $KEY_COMMAND ]; then | |||
78 | else | 79 | else |
79 | echo "SKIPPED: $KEY_COMMAND not executable (/var/run mounted noexec?)" | 80 | echo "SKIPPED: $KEY_COMMAND not executable (/var/run mounted noexec?)" |
80 | fi | 81 | fi |
81 | |||
82 | $SUDO rm -f $KEY_COMMAND | ||
diff --git a/regress/principals-command.sh b/regress/principals-command.sh index 66b5b5bde..197c00021 100644 --- a/regress/principals-command.sh +++ b/regress/principals-command.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: principals-command.sh,v 1.5 2018/10/31 11:09:27 dtucker Exp $ | 1 | # $OpenBSD: principals-command.sh,v 1.6 2018/11/22 08:48:32 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="authorized principals command" | 4 | tid="authorized principals command" |
@@ -30,7 +30,8 @@ CA_FP=`${SSHKEYGEN} -lf $OBJ/user_ca_key.pub | awk '{ print $2 }'` | |||
30 | 30 | ||
31 | # Establish a AuthorizedPrincipalsCommand in /var/run where it will have | 31 | # Establish a AuthorizedPrincipalsCommand in /var/run where it will have |
32 | # acceptable directory permissions. | 32 | # acceptable directory permissions. |
33 | PRINCIPALS_COMMAND="/var/run/principals_command_${LOGNAME}" | 33 | PRINCIPALS_COMMAND="/var/run/principals_command_${LOGNAME}.$$" |
34 | trap "$SUDO rm -f ${PRINCIPALS_COMMAND}" 0 | ||
34 | cat << _EOF | $SUDO sh -c "cat > '$PRINCIPALS_COMMAND'" | 35 | cat << _EOF | $SUDO sh -c "cat > '$PRINCIPALS_COMMAND'" |
35 | #!/bin/sh | 36 | #!/bin/sh |
36 | test "x\$1" != "x${LOGNAME}" && exit 1 | 37 | test "x\$1" != "x${LOGNAME}" && exit 1 |
diff --git a/regress/sftp-chroot.sh b/regress/sftp-chroot.sh index ba5bd1efb..5acc4d2de 100644 --- a/regress/sftp-chroot.sh +++ b/regress/sftp-chroot.sh | |||
@@ -1,11 +1,12 @@ | |||
1 | # $OpenBSD: sftp-chroot.sh,v 1.6 2018/02/09 03:42:57 dtucker Exp $ | 1 | # $OpenBSD: sftp-chroot.sh,v 1.7 2018/11/22 08:48:32 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="sftp in chroot" | 4 | tid="sftp in chroot" |
5 | 5 | ||
6 | CHROOT=/var/run | 6 | CHROOT=/var/run |
7 | FILENAME=testdata_${USER} | 7 | FILENAME=testdata_${USER}.$$ |
8 | PRIVDATA=${CHROOT}/${FILENAME} | 8 | PRIVDATA=${CHROOT}/${FILENAME} |
9 | trap "${SUDO} rm -f ${PRIVDATA}" 0 | ||
9 | 10 | ||
10 | if [ -z "$SUDO" -a ! -w /var/run ]; then | 11 | if [ -z "$SUDO" -a ! -w /var/run ]; then |
11 | echo "need SUDO to create file in /var/run, test won't work without" | 12 | 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 \ | |||
28 | >>$TEST_REGRESS_LOGFILE 2>&1 || \ | 29 | >>$TEST_REGRESS_LOGFILE 2>&1 || \ |
29 | fatal "Fetch ${FILENAME} failed" | 30 | fatal "Fetch ${FILENAME} failed" |
30 | cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ" | 31 | cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ" |
31 | |||
32 | $SUDO rm $PRIVDATA | ||