1 # $OpenBSD: agent-getpeereid.sh,v 1.3 2006/07/06 12:01:53 grunk Exp $
2 # Placed in the Public Domain.
4 tid
="disallow agent attach from other uid"
8 SSH_AUTH_SOCK
=/nonexistant
10 if grep "#undef.*HAVE_GETPEEREID" ${BUILDDIR}/config.h
>/dev
/null
2>&1
12 echo "skipped (not supported on this platform)"
15 if [ -z "$SUDO" ]; then
16 echo "skipped: need SUDO to switch to uid $UNPRIV"
22 eval `${SSHAGENT} -s -a ${ASOCK}` > /dev
/null
25 fail
"could not start ssh-agent: exit code $r"
27 chmod 644 ${SSH_AUTH_SOCK}
29 ssh-add
-l > /dev
/null
2>&1
32 fail
"ssh-add failed with $r != 1"
35 < /dev
/null
${SUDO} -S -u ${UNPRIV} ssh-add
-l > /dev
/null
2>&1
38 fail
"ssh-add did not fail for ${UNPRIV}: $r < 2"
42 ${SSHAGENT} -k > /dev
/null