]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream commit
authordjm@openbsd.org <djm@openbsd.org>
Tue, 3 May 2016 14:41:04 +0000 (14:41 +0000)
committerDamien Miller <djm@mindrot.org>
Wed, 8 Jun 2016 01:42:39 +0000 (11:42 +1000)
support doas

Upstream-Regress-ID: 8d5572b27ea810394eeda432d8b4e9e1064a7c38

regress/agent-getpeereid.sh

index d5ae2d6e27833914c8335c5a721e6f3e5be044bf..24b71f458a04a3b5606abbfda916263c4f9e8735 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: agent-getpeereid.sh,v 1.5 2013/05/17 10:33:09 dtucker Exp $
+#      $OpenBSD: agent-getpeereid.sh,v 1.6 2016/05/03 14:41:04 djm Exp $
 #      Placed in the Public Domain.
 
 tid="disallow agent attach from other uid"
@@ -13,10 +13,16 @@ else
        echo "skipped (not supported on this platform)"
        exit 0
 fi
-if [ -z "$SUDO" ]; then
-       echo "skipped: need SUDO to switch to uid $UNPRIV"
-       exit 0
-fi
+case "x$SUDO" in
+       xsudo) sudo=1;;
+       xdoas) ;;
+       x)
+               echo "need SUDO to switch to uid $UNPRIV"
+               exit 0 ;;
+       *)
+               echo "unsupported $SUDO - "doas" and "sudo" are allowed"
+               exit 0 ;;
+esac
 
 trace "start agent"
 eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null
@@ -31,8 +37,13 @@ else
        if [ $r -ne 1 ]; then
                fail "ssh-add failed with $r != 1"
        fi
-
-       < /dev/null ${SUDO} -S -u ${UNPRIV} ssh-add -l 2>/dev/null
+       if test -z "$sudo" ; then
+               # doas
+               ${SUDO} -n -u ${UNPRIV} ssh-add -l 2>/dev/null
+       else
+               # sudo
+               < /dev/null ${SUDO} -S -u ${UNPRIV} ssh-add -l 2>/dev/null
+       fi
        r=$?
        if [ $r -lt 2 ]; then
                fail "ssh-add did not fail for ${UNPRIV}: $r < 2"