- (dtucker) [contrib/aix/buildbff.sh] Fix creation of ssh_prng_cmds.default
[openssh-git.git] / regress / agent-ptrace.sh
blobd5892ed03098f4b9279840107bc7cbbddc84bc42
1 # $OpenBSD: agent-ptrace.sh,v 1.1 2002/12/09 15:38:30 markus Exp $
2 # Placed in the Public Domain.
4 tid="disallow agent ptrace attach"
6 if have_prog uname ; then
7 case `uname` in
8 AIX|CYGWIN*|OSF1)
9 echo "skipped (not supported on this platform)"
10 exit 0
12 esac
15 if have_prog gdb ; then
16 : ok
17 else
18 echo "skipped (gdb not found)"
19 exit 0
22 if test -z "$SUDO" ; then
23 echo "skipped (SUDO not set)"
24 exit 0
25 else
26 $SUDO chown 0 ${SSHAGENT}
27 $SUDO chgrp 0 ${SSHAGENT}
28 $SUDO chmod 2755 ${SSHAGENT}
31 trace "start agent"
32 eval `${SSHAGENT} -s` > /dev/null
33 r=$?
34 if [ $r -ne 0 ]; then
35 fail "could not start ssh-agent: exit code $r"
36 else
37 # ls -l ${SSH_AUTH_SOCK}
38 gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF
39 quit
40 EOF
41 if [ $? -ne 0 ]; then
42 fail "gdb failed: exit code $?"
44 egrep 'ptrace: Operation not permitted.|procfs:.*Permission denied.|ttrace.*Permission denied.|procfs:.*: Invalid argument.' >/dev/null ${OBJ}/gdb.out
45 r=$?
46 rm -f ${OBJ}/gdb.out
47 if [ $r -ne 0 ]; then
48 fail "ptrace succeeded?: exit code $r"
51 trace "kill agent"
52 ${SSHAGENT} -k > /dev/null