[openssh-commits] [openssh] 06/07: upstream: Test that ssh-agent exits when running as as subprocess

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Jun 19 17:16:27 AEST 2020


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 5dba1fcabacaab46693338ec829b42a1293d1f52
Author: dtucker at openbsd.org <dtucker at openbsd.org>
Date:   Fri Jun 19 05:07:09 2020 +0000

    upstream: Test that ssh-agent exits when running as as subprocess
    
    of a specified command (ie "ssh-agent command").  Would have caught bz#3181.
    
    OpenBSD-Regress-ID: 895b4765ba5153eefaea3160a7fe08ac0b6db8b3
---
 regress/Makefile            |  3 ++-
 regress/agent-subprocess.sh | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/regress/Makefile b/regress/Makefile
index 62794d25..db0268fc 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,4 +1,4 @@
-#	$OpenBSD: Makefile,v 1.108 2020/04/20 04:44:47 djm Exp $
+#	$OpenBSD: Makefile,v 1.109 2020/06/19 05:07:09 dtucker Exp $
 
 tests:		prep file-tests t-exec unit
 
@@ -41,6 +41,7 @@ LTESTS= 	connect \
 		agent-getpeereid \
 		agent-timeout \
 		agent-ptrace \
+		agent-subprocess \
 		keyscan \
 		keygen-change \
 		keygen-convert \
diff --git a/regress/agent-subprocess.sh b/regress/agent-subprocess.sh
new file mode 100644
index 00000000..2f36d70c
--- /dev/null
+++ b/regress/agent-subprocess.sh
@@ -0,0 +1,22 @@
+#	$OpenBSD: agent-subprocess.sh,v 1.1 2020/06/19 05:07:09 dtucker Exp $
+#	Placed in the Public Domain.
+
+tid="agent subprocess"
+
+trace "ensure agent exits when run as subprocess"
+${SSHAGENT} sh -c "echo \$SSH_AGENT_PID >$OBJ/pidfile; sleep 1"
+
+pid=`cat $OBJ/pidfile`
+
+# Currently ssh-agent polls every 10s so we need to wait at least that long.
+n=12
+while kill -0 $pid >/dev/null 2>&1 && test "$n" -gt "0"; do
+	n=$(($n - 1))
+	sleep 1
+done
+
+if test "$n" -eq "0"; then
+	fail "agent still running"
+fi
+
+rm -f $OBJ/pidfile

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list