summaryrefslogtreecommitdiffstats
path: root/regress/keys-command.sh
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2018-11-22 09:48:32 +0100
committerDarren Tucker <dtucker@dtucker.net>2018-11-22 10:58:27 +0100
commite4ae345dc75b34fd870c2e8690d831d2c1088eb7 (patch)
tree3f48b32dd7835a20f41a5b5f26ba9a05207e18e0 /regress/keys-command.sh
parentupstream: UsePrivilegeSeparation no is deprecated (diff)
downloadopenssh-e4ae345dc75b34fd870c2e8690d831d2c1088eb7.tar.xz
openssh-e4ae345dc75b34fd870c2e8690d831d2c1088eb7.zip
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
Diffstat (limited to 'regress/keys-command.sh')
-rw-r--r--regress/keys-command.sh7
1 files changed, 3 insertions, 4 deletions
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 @@
-# $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