1 # $OpenBSD: agent-getpeereid.sh,v 1.2 2005/11/14 21:25:56 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)"
17 eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null
20 fail "could not start ssh-agent: exit code $r"
22 chmod 644 ${SSH_AUTH_SOCK}
24 ssh-add -l > /dev/null 2>&1
27 fail "ssh-add failed with $r != 1"
30 < /dev/null ${SUDO} -S -u ${UNPRIV} ssh-add -l > /dev/null 2>&1
33 fail "ssh-add did not fail for ${UNPRIV}: $r < 2"
37 ${SSHAGENT} -k > /dev/null