]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: mux: fix incorrect return value check in local forward
authordjm@openbsd.org <djm@openbsd.org>
Fri, 4 Jul 2025 00:17:55 +0000 (00:17 +0000)
committerDamien Miller <djm@mindrot.org>
Fri, 4 Jul 2025 00:20:08 +0000 (10:20 +1000)
cancellation

channel_cancel_lport_listener() returns 1 on success and 0 on failure.
The previous code incorrectly checked for `== -1`, a value the function
never returns, so failure was not detected and the "port not found"
error message was never shown when cancelling dynamic or local port
forwards.

From: Boris Tonofa <b.tonofa@ideco.ru>

OpenBSD-Commit-ID: 3e9d2252a4d0bd318d4f25e2b518afb44acea170

mux.c

diff --git a/mux.c b/mux.c
index 415024f74e8feeada8ab3290eb9d19a833829780..1a4f357d46f052f53dbc38d7fe4f50afa8f23b22 100644 (file)
--- a/mux.c
+++ b/mux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mux.c,v 1.103 2024/10/12 10:50:37 jsg Exp $ */
+/* $OpenBSD: mux.c,v 1.104 2025/07/04 00:17:55 djm Exp $ */
 /*
  * Copyright (c) 2002-2008 Damien Miller <djm@openbsd.org>
  *
@@ -931,7 +931,7 @@ mux_master_process_close_fwd(struct ssh *ssh, u_int rid,
        } else {        /* local and dynamic forwards */
                /* Ditto */
                if (channel_cancel_lport_listener(ssh, &fwd, fwd.connect_port,
-                   &options.fwd_opts) == -1)
+                   &options.fwd_opts) != 1)
                        error_reason = "port not found";
        }