diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2002-12-09 15:38:31 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2002-12-09 15:38:31 +0000 |
commit | 7cf81550dac1d2de97a051959891264daea3d2a9 (patch) | |
tree | 36f741c58da9aa52208bddc6abc42cd4e81a5c71 /regress/usr.bin/ssh/agent-ptrace.sh | |
parent | cade3f2ea1ee4e5e1be676b348e0bbe1254f7ed3 (diff) |
make sure gdb cannot attach to a running agent
Diffstat (limited to 'regress/usr.bin/ssh/agent-ptrace.sh')
-rw-r--r-- | regress/usr.bin/ssh/agent-ptrace.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/regress/usr.bin/ssh/agent-ptrace.sh b/regress/usr.bin/ssh/agent-ptrace.sh new file mode 100644 index 00000000000..9f9c99960ca --- /dev/null +++ b/regress/usr.bin/ssh/agent-ptrace.sh @@ -0,0 +1,28 @@ +# $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" + +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 + grep -q 'ptrace: Operation not permitted.' ${OBJ}/gdb.out + 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 |