]> andersk Git - gssapi-openssh.git/blob - openssh/regress/agent-getpeereid.sh
Import of OpenSSH 4.4p1
[gssapi-openssh.git] / openssh / regress / agent-getpeereid.sh
1 #       $OpenBSD: agent-getpeereid.sh,v 1.3 2006/07/06 12:01:53 grunk Exp $
2 #       Placed in the Public Domain.
3
4 tid="disallow agent attach from other uid"
5
6 UNPRIV=nobody
7 ASOCK=${OBJ}/agent
8 SSH_AUTH_SOCK=/nonexistant
9
10 if grep "#undef.*HAVE_GETPEEREID" ${BUILDDIR}/config.h >/dev/null 2>&1
11 then
12         echo "skipped (not supported on this platform)"
13         exit 0
14 fi
15 if [ -z "$SUDO" ]; then
16         echo "skipped: need SUDO to switch to uid $UNPRIV"
17         exit 0
18 fi
19
20
21 trace "start agent"
22 eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null
23 r=$?
24 if [ $r -ne 0 ]; then
25         fail "could not start ssh-agent: exit code $r"
26 else
27         chmod 644 ${SSH_AUTH_SOCK}
28
29         ssh-add -l > /dev/null 2>&1
30         r=$?
31         if [ $r -ne 1 ]; then
32                 fail "ssh-add failed with $r != 1"
33         fi
34
35         < /dev/null ${SUDO} -S -u ${UNPRIV} ssh-add -l > /dev/null 2>&1
36         r=$?
37         if [ $r -lt 2 ]; then
38                 fail "ssh-add did not fail for ${UNPRIV}: $r < 2"
39         fi
40
41         trace "kill agent"
42         ${SSHAGENT} -k > /dev/null
43 fi
44
45 rm -f ${OBJ}/agent
This page took 0.04102 seconds and 5 git commands to generate.