2003-01-22 07:53:16 +01:00
|
|
|
# $OpenBSD: agent-ptrace.sh,v 1.1 2002/12/09 15:38:30 markus Exp $
|
|
|
|
# Placed in the Public Domain.
|
|
|
|
|
|
|
|
tid="disallow agent ptrace attach"
|
|
|
|
|
2003-09-07 01:22:21 +02:00
|
|
|
if [ -x "`which uname 2>&1`" ]; then
|
2003-09-04 05:55:25 +02:00
|
|
|
case `uname` in
|
2003-09-04 14:06:16 +02:00
|
|
|
Linux|HP-UX|SunOS|NetBSD|AIX|CYGWIN*)
|
|
|
|
echo "skipped (not supported on this platform)"
|
2003-09-04 05:55:25 +02:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2003-09-07 01:22:21 +02:00
|
|
|
if [ ! -x "`which gdb 2>&1`" ]; then
|
2003-09-04 05:55:25 +02:00
|
|
|
echo "skipped (gdb not found)"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2003-01-22 07:53:16 +01:00
|
|
|
trace "start agent"
|
|
|
|
eval `${SSHAGENT} -s` > /dev/null
|
|
|
|
r=$?
|
|
|
|
if [ $r -ne 0 ]; then
|
|
|
|
fail "could not start ssh-agent: exit code $r"
|
|
|
|
else
|
|
|
|
# ls -l ${SSH_AUTH_SOCK}
|
|
|
|
gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF
|
|
|
|
quit
|
|
|
|
EOF
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
fail "gdb failed: exit code $?"
|
|
|
|
fi
|
2003-09-04 07:07:59 +02:00
|
|
|
grep 'ptrace: Operation not permitted.' >/dev/null ${OBJ}/gdb.out
|
2003-01-22 07:53:16 +01:00
|
|
|
r=$?
|
|
|
|
rm -f ${OBJ}/gdb.out
|
|
|
|
if [ $r -ne 0 ]; then
|
|
|
|
fail "ptrace succeeded?: exit code $r"
|
|
|
|
fi
|
|
|
|
|
|
|
|
trace "kill agent"
|
|
|
|
${SSHAGENT} -k > /dev/null
|
|
|
|
fi
|