From: djm@openbsd.org Date: Thu, 30 Oct 2025 03:19:54 +0000 (+0000) Subject: upstream: Activate UnusedConnectionTimeout only after last channel X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f3e65bda22b65dc5fff82df1e97af07456fed42;p=thirdparty%2Fopenssh-portable.git 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 --- 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 * Copyright (c) 1995 Tatu Ylonen , 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; } - ptimeout_deadline_monotime(&timeout, unused_connection_expiry); } + if (unused_connection_expiry != 0) + ptimeout_deadline_monotime(&timeout, unused_connection_expiry); /* * if using client_alive, set the max timeout accordingly,