1 # $OpenBSD: agent-getpeereid.sh,v 1.4 2007/11/25 15:35:09 jmc Exp $
2 # Placed in the Public Domain.
4 tid
="disallow agent attach from other uid"
8 SSH_AUTH_SOCK
=/nonexistent
10 if config_defined HAVE_GETPEEREID HAVE_GETPEERUCRED HAVE_SO_PEERCRED
; then
13 echo "skipped (not supported on this platform)"
16 if [ -z "$SUDO" ]; then
17 echo "skipped: need SUDO to switch to uid $UNPRIV"
23 eval `${SSHAGENT} -s -a ${ASOCK}` > /dev
/null
26 fail
"could not start ssh-agent: exit code $r"
28 chmod 644 ${SSH_AUTH_SOCK}
30 ssh-add
-l > /dev
/null
2>&1
33 fail
"ssh-add failed with $r != 1"
36 < /dev
/null
${SUDO} -S -u ${UNPRIV} ssh-add
-l 2>/dev
/null
39 fail
"ssh-add did not fail for ${UNPRIV}: $r < 2"
43 ${SSHAGENT} -k > /dev
/null