[openssh-commits] [openssh] 02/06: upstream: the tunnel-forwarding vs ExitOnForwardFailure fix that I

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Apr 3 15:41:38 AEDT 2020


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

djm pushed a commit to branch master
in repository openssh.

commit 7b4d8999f2e1a0cb7b065e3efa83e6edccfc7d82
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri Apr 3 04:03:51 2020 +0000

    upstream: the tunnel-forwarding vs ExitOnForwardFailure fix that I
    
    committed earlier had an off-by-one. Fix this and add some debugging that
    would have made it apparent sooner.
    
    OpenBSD-Commit-ID: 082f8f72b1423bd81bbdad750925b906e5ac6910
---
 ssh.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/ssh.c b/ssh.c
index d99a245a..2ae45413 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.523 2020/04/03 02:40:32 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.524 2020/04/03 04:03:51 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1676,10 +1676,15 @@ fork_postauth(void)
 static void
 forwarding_success(void)
 {
-	if (forward_confirms_pending > 0 && --forward_confirms_pending == 0) {
-		debug("All forwarding requests processed");
+	if (forward_confirms_pending == -1)
+		return;
+	if (--forward_confirms_pending == 0) {
+		debug("%s: all expected forwarding replies received");
 		if (fork_after_authentication_flag)
 			fork_postauth();
+	} else {
+		debug2("%s: %d expected forwarding replies remaining",
+		    __func__, forward_confirms_pending);
 	}
 }
 
@@ -1800,6 +1805,8 @@ ssh_init_forwarding(struct ssh *ssh, char **ifname)
 	int success = 0;
 	int i;
 
+	if (options.exit_on_forward_failure)
+		forward_confirms_pending = 0; /* track pending requests */
 	/* Initiate local TCP/IP port forwardings. */
 	for (i = 0; i < options.num_local_forwards; i++) {
 		debug("Local connections to %.200s:%d forwarded to remote "
@@ -1859,6 +1866,10 @@ ssh_init_forwarding(struct ssh *ssh, char **ifname)
 		else
 			error("Could not request tunnel forwarding.");
 	}
+	if (forward_confirms_pending > 0) {
+		debug("%s: expecting replies for %d forwards", __func__,
+		    forward_confirms_pending);
+	}
 }
 
 static void

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


More information about the openssh-commits mailing list