summaryrefslogtreecommitdiff
path: root/regress/usr.bin/ssh
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2002-12-09 15:38:31 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2002-12-09 15:38:31 +0000
commit7cf81550dac1d2de97a051959891264daea3d2a9 (patch)
tree36f741c58da9aa52208bddc6abc42cd4e81a5c71 /regress/usr.bin/ssh
parentcade3f2ea1ee4e5e1be676b348e0bbe1254f7ed3 (diff)
make sure gdb cannot attach to a running agent
Diffstat (limited to 'regress/usr.bin/ssh')
-rw-r--r--regress/usr.bin/ssh/Makefile3
-rw-r--r--regress/usr.bin/ssh/agent-ptrace.sh28
2 files changed, 30 insertions, 1 deletions
diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile
index 2e18067276d..e50fce34115 100644
--- a/regress/usr.bin/ssh/Makefile
+++ b/regress/usr.bin/ssh/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.17 2002/09/02 20:01:44 avsm Exp $
+# $OpenBSD: Makefile,v 1.18 2002/12/09 15:38:30 markus Exp $
REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7
@@ -18,6 +18,7 @@ LTESTS= connect \
yes-head \
agent \
agent-timeout \
+ agent-ptrace \
keyscan \
keygen-change \
sftp \
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