[openssh-commits] [openssh] 03/07: upstream: add a start_ssh_agent() function that sets up an agent

git+noreply at mindrot.org git+noreply at mindrot.org
Sat May 24 17:23:53 AEST 2025


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

dtucker pushed a commit to branch master
in repository openssh.

commit e3c58113ebb3397b252ff26e0e94f726b7db7a8a
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Sat May 24 04:40:37 2025 +0000

    upstream: add a start_ssh_agent() function that sets up an agent
    
    with logging
    
    OpenBSD-Regress-ID: 7f9f30f9c64acbd4b418a5e1a19140cc988071a8
---
 regress/test-exec.sh | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index 714636f6e..d4d40c2ae 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
-#	$OpenBSD: test-exec.sh,v 1.128 2025/05/21 08:36:39 djm Exp $
+#	$OpenBSD: test-exec.sh,v 1.129 2025/05/24 04:40:37 djm Exp $
 #	Placed in the Public Domain.
 
 #SUDO=sudo
@@ -927,7 +927,7 @@ p11_setup() {
 		/usr/lib64/pkcs11/libsofthsm2.so \
 		/usr/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so
 	test -z "$TEST_SSH_PKCS11" && return 1
-	verbose "using token library $TEST_SSH_PKCS11"
+	trace "using token library $TEST_SSH_PKCS11"
 	TEST_SSH_PIN=1234
 	TEST_SSH_SOPIN=12345678
 	if [ "x$TEST_SSH_SSHPKCS11HELPER" != "x" ]; then
@@ -995,6 +995,28 @@ p11_ssh_add() {
 	env SSH_ASKPASS="$PIN_SH" SSH_ASKPASS_REQUIRE=force ${SSHADD} "$@"
 }
 
+start_ssh_agent() {
+	EXTRA_AGENT_ARGS="$1"
+	SSH_AUTH_SOCK="$OBJ/agent.sock"
+	export SSH_AUTH_SOCK
+	rm -f $SSH_AUTH_SOCK $OBJ/agent.log
+	trace "start agent"
+	${SSHAGENT} ${EXTRA_AGENT_ARGS} -d -a $SSH_AUTH_SOCK \
+	    > $OBJ/agent.log 2>&1 &
+	AGENT_PID=$!
+	trap "kill $AGENT_PID" EXIT
+	for x in 0 1 2 3 4 ; do
+		# Give it a chance to start
+		${SSHADD} -l > /dev/null 2>&1
+		r=$?
+		test $r -eq 1 && break
+		sleep 1
+	done
+	if [ $r -ne 1 ]; then
+		fatal "ssh-add -l did not fail with exit code 1 (got $r)"
+	fi
+}
+
 # source test body
 . $SCRIPT
 

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


More information about the openssh-commits mailing list