diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2002-06-06 00:38:41 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2002-06-06 00:38:41 +0000 |
commit | 15e1333d49c431b873c58d355b25ac68660d341e (patch) | |
tree | 6848469d1a842232102737dd45f32fb2f6d58a2c | |
parent | e58632c60715a76566d1a35408ce90506262fac8 (diff) |
test ssh-agent timeout feature
-rw-r--r-- | regress/usr.bin/ssh/Makefile | 3 | ||||
-rw-r--r-- | regress/usr.bin/ssh/agent-timeout.sh | 36 |
2 files changed, 38 insertions, 1 deletions
diff --git a/regress/usr.bin/ssh/Makefile b/regress/usr.bin/ssh/Makefile index 3aa0c834ae4..34b63e97504 100644 --- a/regress/usr.bin/ssh/Makefile +++ b/regress/usr.bin/ssh/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.13 2002/04/01 22:15:08 markus Exp $ +# $OpenBSD: Makefile,v 1.14 2002/06/06 00:38:40 markus Exp $ REGRESSTARGETS= t1 t2 t3 t4 t5 t6 t7 @@ -17,6 +17,7 @@ LTESTS= connect \ try-ciphers \ yes-head \ agent \ + agent-timeout \ keyscan \ sftp \ forwarding diff --git a/regress/usr.bin/ssh/agent-timeout.sh b/regress/usr.bin/ssh/agent-timeout.sh new file mode 100644 index 00000000000..28b1be02811 --- /dev/null +++ b/regress/usr.bin/ssh/agent-timeout.sh @@ -0,0 +1,36 @@ +# $OpenBSD: agent-timeout.sh,v 1.1 2002/06/06 00:38:40 markus Exp $ +# Placed in the Public Domain. + +tid="agent timeout test" + +TIMEOUT=5 + +trace "start agent" +eval `${SSHAGENT} -s` > /dev/null +r=$? +if [ $r -ne 0 ]; then + fail "could not start ssh-agent: exit code $r" +else + trace "add keys with timeout" + for t in rsa rsa1; do + ${SSHADD} -t ${TIMEOUT} $OBJ/$t > /dev/null 2>&1 + if [ $? -ne 0 ]; then + fail "ssh-add did succeed exit code 0" + fi + done + n=`${SSHADD} -l 2> /dev/null | wc -l` + trace "agent has $n keys" + if [ $n -ne 2 ]; then + fail "ssh-add -l did not return 2 keys: $n" + fi + trace "sleeping 2*${TIMEOUT} seconds" + sleep ${TIMEOUT} + sleep ${TIMEOUT} + ${SSHADD} -l 2> /dev/null | grep -q 'The agent has no identities.' + if [ $? -ne 0 ]; then + fail "ssh-add -l still returns keys after timeout" + fi + + trace "kill agent" + ${SSHAGENT} -k > /dev/null +fi |