1# $OpenBSD: agent-ptrace.sh,v 1.1 2002/12/09 15:38:30 markus Exp $ 2# Placed in the Public Domain. 3 4tid="disallow agent ptrace attach" 5 6trace "start agent" 7eval `${SSHAGENT} -s` > /dev/null 8r=$? 9if [ $r -ne 0 ]; then 10 fail "could not start ssh-agent: exit code $r" 11else 12 # ls -l ${SSH_AUTH_SOCK} 13 gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF 14 quit 15EOF 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 28fi 29