source: trunk/third/openssh/regress/agent-getpeereid.sh @ 22570

Revision 22570, 839 bytes checked in by ghudson, 18 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r22569, which included commits to RCS files with non-trunk default branches.
Line 
1#       $OpenBSD: agent-getpeereid.sh,v 1.1 2002/12/09 16:05:02 markus Exp $
2#       Placed in the Public Domain.
3
4tid="disallow agent attach from other uid"
5
6UNPRIV=nobody
7ASOCK=${OBJ}/agent
8SSH_AUTH_SOCK=/nonexistant
9
10if grep "#undef.*HAVE_GETPEEREID" ${BUILDDIR}/config.h >/dev/null 2>&1
11then
12        echo "skipped (not supported on this platform)"
13        exit 0
14fi
15
16trace "start agent"
17eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null
18r=$?
19if [ $r -ne 0 ]; then
20        fail "could not start ssh-agent: exit code $r"
21else
22        chmod 644 ${SSH_AUTH_SOCK}
23
24        ssh-add -l > /dev/null 2>&1
25        r=$?
26        if [ $r -ne 1 ]; then
27                fail "ssh-add failed with $r != 1"
28        fi
29
30        < /dev/null sudo -S -u ${UNPRIV} ssh-add -l > /dev/null 2>&1
31        r=$?
32        if [ $r -lt 2 ]; then
33                fail "ssh-add did not fail for ${UNPRIV}: $r < 2"
34        fi
35
36        trace "kill agent"
37        ${SSHAGENT} -k > /dev/null
38fi
39
40rm -f ${OBJ}/agent
Note: See TracBrowser for help on using the repository browser.