Damien Miller | 8b9cde7 | 2003-01-22 17:53:16 +1100 | [diff] [blame] | 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 | |
| 6 | trace "start agent" |
| 7 | eval `${SSHAGENT} -s` > /dev/null |
| 8 | r=$? |
| 9 | if [ $r -ne 0 ]; then |
| 10 | fail "could not start ssh-agent: exit code $r" |
| 11 | else |
| 12 | # ls -l ${SSH_AUTH_SOCK} |
| 13 | gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF |
| 14 | quit |
| 15 | EOF |
| 16 | if [ $? -ne 0 ]; then |
| 17 | fail "gdb failed: exit code $?" |
| 18 | fi |
| 19 | grep -q 'ptrace: Operation not permitted.' ${OBJ}/gdb.out |
| 20 | r=$? |
| 21 | rm -f ${OBJ}/gdb.out |
| 22 | if [ $r -ne 0 ]; then |
| 23 | fail "ptrace succeeded?: exit code $r" |
| 24 | fi |
| 25 | |
| 26 | trace "kill agent" |
| 27 | ${SSHAGENT} -k > /dev/null |
| 28 | fi |