diff options
Diffstat (limited to 'regress/agent-getpeereid.sh')
-rw-r--r-- | regress/agent-getpeereid.sh | 25 |
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 | ||
4 | tid="disallow agent attach from other uid" | 4 | tid="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 |
15 | fi | 15 | fi |
16 | if [ -z "$SUDO" ]; then | 16 | case "x$SUDO" in |
17 | echo "skipped: need SUDO to switch to uid $UNPRIV" | 17 | xsudo) sudo=1;; |
18 | exit 0 | 18 | xdoas) ;; |
19 | fi | 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 ;; | ||
25 | esac | ||
20 | 26 | ||
21 | trace "start agent" | 27 | trace "start agent" |
22 | eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null | 28 | eval `${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" |