]>
Commit | Line | Data |
---|---|---|
6a9b3198 | 1 | # $OpenBSD: agent-ptrace.sh,v 1.1 2002/12/09 15:38:30 markus Exp $ |
2 | # Placed in the Public Domain. | |
3 | ||
4 | tid="disallow agent ptrace attach" | |
5 | ||
0fff78ff | 6 | if have_prog uname ; then |
7 | case `uname` in | |
9cb1827b | 8 | Linux|HP-UX|SunOS|NetBSD|AIX|CYGWIN*) |
0fff78ff | 9 | echo "skipped (not supported on this platform)" |
10 | exit 0 | |
11 | ;; | |
12 | esac | |
13 | fi | |
14 | ||
15 | if have_prog gdb ; then | |
16 | : ok | |
17 | else | |
18 | echo "skipped (gdb not found)" | |
19 | exit 0 | |
20 | fi | |
21 | ||
6a9b3198 | 22 | trace "start agent" |
23 | eval `${SSHAGENT} -s` > /dev/null | |
24 | r=$? | |
25 | if [ $r -ne 0 ]; then | |
26 | fail "could not start ssh-agent: exit code $r" | |
27 | else | |
28 | # ls -l ${SSH_AUTH_SOCK} | |
29 | gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF | |
30 | quit | |
31 | EOF | |
32 | if [ $? -ne 0 ]; then | |
33 | fail "gdb failed: exit code $?" | |
34 | fi | |
9cb1827b | 35 | grep 'ptrace: Operation not permitted.' >/dev/null ${OBJ}/gdb.out |
6a9b3198 | 36 | r=$? |
37 | rm -f ${OBJ}/gdb.out | |
38 | if [ $r -ne 0 ]; then | |
39 | fail "ptrace succeeded?: exit code $r" | |
40 | fi | |
41 | ||
42 | trace "kill agent" | |
43 | ${SSHAGENT} -k > /dev/null | |
44 | fi |