[openssh-commits] [openssh] 02/02: upstream: Activate UnusedConnectionTimeout only after last channel

git+noreply at mindrot.org git+noreply at mindrot.org
Thu Oct 30 14:21:00 AEDT 2025


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

djm pushed a commit to branch master
in repository openssh.

commit 4f3e65bda22b65dc5fff82df1e97af07456fed42
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Thu Oct 30 03:19:54 2025 +0000

    upstream: Activate UnusedConnectionTimeout only after last channel
    
    has closed. Previously UnusedConnectionTimeout could fire early after a
    ChannelTimeout.
    
    This was not a problem for the OpenSSH client because it terminates
    once all channels have closed but could cause problems for other
    clients (e.g. API clients) that do things differently.
    
    bz3827; ok dtucker
    
    OpenBSD-Commit-ID: ff2e4607cbd4e600de3c8a5ece3b0e4bb641ed8f
---
 serverloop.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/serverloop.c b/serverloop.c
index 5d3b194d1..dba2fc305 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: serverloop.c,v 1.244 2025/09/25 06:23:19 jsg Exp $ */
+/* $OpenBSD: serverloop.c,v 1.245 2025/10/30 03:19:54 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -178,12 +178,15 @@ wait_until_can_do_something(struct ssh *ssh,
 	 * start the clock to terminate the connection.
 	 */
 	if (options.unused_connection_timeout != 0) {
-		if (channel_still_open(ssh) || unused_connection_expiry == 0) {
+		if (channel_still_open(ssh))
+			unused_connection_expiry = 0;
+		else if (unused_connection_expiry == 0) {
 			unused_connection_expiry = now +
 			    options.unused_connection_timeout;
 		}
+	}
+	if (unused_connection_expiry != 0)
 		ptimeout_deadline_monotime(&timeout, unused_connection_expiry);
-	}
 
 	/*
 	 * if using client_alive, set the max timeout accordingly,

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


More information about the openssh-commits mailing list