summaryrefslogtreecommitdiff
path: root/regress/agent-getpeereid.sh
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2016-05-03 14:41:04 +0000
committerDamien Miller <djm@mindrot.org>2016-06-08 11:42:39 +1000
commit07d5608bb237e9b3fe86a2aeaa429392230faebf (patch)
treec3d0426a4a10c3037463f71ce4062ad73cb600de /regress/agent-getpeereid.sh
parent01cabf10adc7676cba5f40536a34d3b246edb73f (diff)
upstream commit
support doas Upstream-Regress-ID: 8d5572b27ea810394eeda432d8b4e9e1064a7c38
Diffstat (limited to 'regress/agent-getpeereid.sh')
-rw-r--r--regress/agent-getpeereid.sh25
1 files changed, 18 insertions, 7 deletions
diff --git a/regress/agent-getpeereid.sh b/regress/agent-getpeereid.sh
index d5ae2d6e2..24b71f458 100644
--- a/regress/agent-getpeereid.sh
+++ b/regress/agent-getpeereid.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: agent-getpeereid.sh,v 1.5 2013/05/17 10:33:09 dtucker Exp $ 1# $OpenBSD: agent-getpeereid.sh,v 1.6 2016/05/03 14:41:04 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="disallow agent attach from other uid" 4tid="disallow agent attach from other uid"
@@ -13,10 +13,16 @@ else
13 echo "skipped (not supported on this platform)" 13 echo "skipped (not supported on this platform)"
14 exit 0 14 exit 0
15fi 15fi
16if [ -z "$SUDO" ]; then 16case "x$SUDO" in
17 echo "skipped: need SUDO to switch to uid $UNPRIV" 17 xsudo) sudo=1;;
18 exit 0 18 xdoas) ;;
19fi 19 x)
20 echo "need SUDO to switch to uid $UNPRIV"
21 exit 0 ;;
22 *)
23 echo "unsupported $SUDO - "doas" and "sudo" are allowed"
24 exit 0 ;;
25esac
20 26
21trace "start agent" 27trace "start agent"
22eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null 28eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null
@@ -31,8 +37,13 @@ else
31 if [ $r -ne 1 ]; then 37 if [ $r -ne 1 ]; then
32 fail "ssh-add failed with $r != 1" 38 fail "ssh-add failed with $r != 1"
33 fi 39 fi
34 40 if test -z "$sudo" ; then
35 < /dev/null ${SUDO} -S -u ${UNPRIV} ssh-add -l 2>/dev/null 41 # doas
42 ${SUDO} -n -u ${UNPRIV} ssh-add -l 2>/dev/null
43 else
44 # sudo
45 < /dev/null ${SUDO} -S -u ${UNPRIV} ssh-add -l 2>/dev/null
46 fi
36 r=$? 47 r=$?
37 if [ $r -lt 2 ]; then 48 if [ $r -lt 2 ]; then
38 fail "ssh-add did not fail for ${UNPRIV}: $r < 2" 49 fail "ssh-add did not fail for ${UNPRIV}: $r < 2"