summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2012-12-07 13:03:10 +1100
committerDarren Tucker <dtucker@zip.com.au>2012-12-07 13:03:10 +1100
commit3dfb877046b40638ac7c88de9bb07091eb463205 (patch)
treeb96d477ccd573ce010d847b2bda3095d72cc69bb /regress
parent96ce9a1e45a2f2a1b8be7b97fde07e629dd9fa05 (diff)
- dtucker@cvs.openbsd.org 2012/12/06 06:06:54
[regress/keys-command.sh] Fix some problems with the keys-command test: - use string comparison rather than numeric comparison - check for existing KEY_COMMAND file and don't clobber if it exists - clean up KEY_COMMAND file if we do create it. - check that KEY_COMMAND is executable (which it won't be if eg /var/run is mounted noexec). ok djm.
Diffstat (limited to 'regress')
-rw-r--r--regress/keys-command.sh16
1 files changed, 11 insertions, 5 deletions
diff --git a/regress/keys-command.sh b/regress/keys-command.sh
index 09f4db4b7..b595a434f 100644
--- a/regress/keys-command.sh
+++ b/regress/keys-command.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: keys-command.sh,v 1.1 2012/11/22 22:49:30 djm Exp $ 1# $OpenBSD: keys-command.sh,v 1.2 2012/12/06 06:06:54 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="authorized keys from command" 4tid="authorized keys from command"
@@ -14,7 +14,7 @@ fi
14KEY_COMMAND="/var/run/keycommand_${LOGNAME}" 14KEY_COMMAND="/var/run/keycommand_${LOGNAME}"
15cat << _EOF | $SUDO sh -c "cat > '$KEY_COMMAND'" 15cat << _EOF | $SUDO sh -c "cat > '$KEY_COMMAND'"
16#!/bin/sh 16#!/bin/sh
17test "x\$1" -ne "x${LOGNAME}" && exit 1 17test "x\$1" != "x${LOGNAME}" && exit 1
18exec cat "$OBJ/authorized_keys_${LOGNAME}" 18exec cat "$OBJ/authorized_keys_${LOGNAME}"
19_EOF 19_EOF
20$SUDO chmod 0755 "$KEY_COMMAND" 20$SUDO chmod 0755 "$KEY_COMMAND"
@@ -27,7 +27,13 @@ cp $OBJ/sshd_proxy $OBJ/sshd_proxy.bak
27 echo AuthorizedKeysCommandUser ${LOGNAME} 27 echo AuthorizedKeysCommandUser ${LOGNAME}
28) > $OBJ/sshd_proxy 28) > $OBJ/sshd_proxy
29 29
30${SSH} -F $OBJ/ssh_proxy somehost true 30if [ -x $KEY_COMMAND ]; then
31if [ $? -ne 0 ]; then 31 ${SSH} -F $OBJ/ssh_proxy somehost true
32 fail "connect failed" 32 if [ $? -ne 0 ]; then
33 fail "connect failed"
34 fi
35else
36 echo "SKIPPED: $KEY_COMMAND not executable (/var/run mounted noexec?)"
33fi 37fi
38
39$SUDO rm -f $KEY_COMMAND