upstream commit
support doas Upstream-Regress-ID: 8d5572b27ea810394eeda432d8b4e9e1064a7c38
This commit is contained in:
parent
01cabf10ad
commit
07d5608bb2
|
@ -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.
|
# Placed in the Public Domain.
|
||||||
|
|
||||||
tid="disallow agent attach from other uid"
|
tid="disallow agent attach from other uid"
|
||||||
|
@ -13,10 +13,16 @@ else
|
||||||
echo "skipped (not supported on this platform)"
|
echo "skipped (not supported on this platform)"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if [ -z "$SUDO" ]; then
|
case "x$SUDO" in
|
||||||
echo "skipped: need SUDO to switch to uid $UNPRIV"
|
xsudo) sudo=1;;
|
||||||
exit 0
|
xdoas) ;;
|
||||||
fi
|
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"
|
trace "start agent"
|
||||||
eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null
|
eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null
|
||||||
|
@ -31,8 +37,13 @@ else
|
||||||
if [ $r -ne 1 ]; then
|
if [ $r -ne 1 ]; then
|
||||||
fail "ssh-add failed with $r != 1"
|
fail "ssh-add failed with $r != 1"
|
||||||
fi
|
fi
|
||||||
|
if test -z "$sudo" ; then
|
||||||
< /dev/null ${SUDO} -S -u ${UNPRIV} ssh-add -l 2>/dev/null
|
# 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=$?
|
r=$?
|
||||||
if [ $r -lt 2 ]; then
|
if [ $r -lt 2 ]; then
|
||||||
fail "ssh-add did not fail for ${UNPRIV}: $r < 2"
|
fail "ssh-add did not fail for ${UNPRIV}: $r < 2"
|
||||||
|
|
Loading…
Reference in New Issue