From c90b2392302b9dffa65e57b518f3fb5d1c5783fb Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Fri, 9 Jan 2026 16:31:29 +0100 Subject: [PATCH] tests: Skip agent forwarding test if we are too deep in filesystem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The maximal lenght of unix domain socket path is 108 characters. When the build directory (and UID wrapper home directories) are too deep in the filesystem, OpenSSH will fail to create the socket file, which is failing this test. Signed-off-by: Jakub Jelen Reviewed-by: Pavol Žáčik Reviewed-by: Andreas Schneider --- tests/client/torture_auth_agent_forwarding.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/client/torture_auth_agent_forwarding.c b/tests/client/torture_auth_agent_forwarding.c index c779a302..cdde5328 100644 --- a/tests/client/torture_auth_agent_forwarding.c +++ b/tests/client/torture_auth_agent_forwarding.c @@ -18,6 +18,10 @@ #include #include /* usleep */ +#ifndef UNIX_PATH_MAX +#define UNIX_PATH_MAX 108 +#endif + /* struct to store the state of the test */ struct agent_callback_state { int called; @@ -137,6 +141,19 @@ static void torture_auth_agent_forwarding(void **state) int read_count = 0; bool agent_available = false; bool agent_not_available_found = false; + size_t exp_socket_len; + + /* The forwarded agent socket is created under the home directory, which + * might easily extend the maximum unix domain socket path length. + * If we see this, just skip the test as it will not work */ + exp_socket_len = strlen(BINARYDIR) + + strlen("/home/bob/.ssh/agent.1234567890.sshd.XXXXXXXXXX"); + if (exp_socket_len > UNIX_PATH_MAX) { + SSH_LOG(SSH_LOG_WARNING, + "The working directory is too long for agent forwarding to work" + ": Skipping the test"); + skip(); + } assert_non_null(s); session = s->ssh.ssh.session;