Sorry, this snuck back in along with another commit.

Does this fix it?

diff --git a/readconf.c b/readconf.c
index cec6844..85e8c6f 100644
--- a/readconf.c
+++ b/readconf.c
@@ -2769,7 +2769,7 @@ parse_jump(const char *s, Options *o, int active)
 {
        char *orig, *sdup, *cp;
        char *host = NULL, *user = NULL;
-       int ret = -1, port = -1, first;
+       int r, ret = -1, port = -1, first;
 
        active &= o->proxy_command == NULL && o->jump_host == NULL;
 
@@ -2785,14 +2785,19 @@ parse_jump(const char *s, Options *o, int active)
 
                if (first) {
                        /* First argument and configuration is active */
-                       if (parse_ssh_uri(cp, &user, &host, &port) == -1 &&
-                           parse_user_host_port(cp, &user, &host, &port) != 0)
+                       r = parse_ssh_uri(cp, &user, &host, &port);
+                       if (r == -1 || (r == 1 &&
+                           parse_user_host_port(cp, &user, &host, &port) != 0))
                                goto out;
                } else {
                        /* Subsequent argument or inactive configuration */
                        if (parse_ssh_uri(cp, NULL, NULL, NULL) == -1 &&
                            parse_user_host_port(cp, NULL, NULL, NULL) != 0)
                                goto out;
+                       r = parse_ssh_uri(cp, NULL, NULL, NULL);
+                       if (r == -1 || (r == 1 &&
+                           parse_user_host_port(cp, NULL, NULL, NULL) != 0))
+                               goto out;
                }
                first = 0; /* only check syntax for subsequent hosts */
        } while (cp != sdup);

On Mon, 21 Dec 2020, Theo Buehler wrote:

> Not sure if you saw that. Seems to be a logic error due to the fact that
> parse_ssh_uri() has three possible return values (-1, 0, 1), not 2.
> Full original report is here:
> 
> https://marc.info/?l=openbsd-bugs&m=160844761615469&w=2
> 
> ----- Forwarded message from Theo Buehler <[email protected]> -----
> 
> Date: Sun, 20 Dec 2020 14:18:02 +0100
> From: Theo Buehler <[email protected]>
> To: Raf Czlonka <[email protected]>
> Cc: [email protected]
> Subject: Re: ssh_config(5) ProxyJump option not working in the latest snapshot
> 
> > I can see that there's been a number of changes committed to OpenSSH
> > recently[0] so, unless there's a snapshot-only change, this is most
> > likely related.
> 
> Reverting this part of the change in readconf.c r1.344 "fixes" it for me.
> The issue I run into with 'ssh -J host1 host2' is that parse_ssh_uri()
> returns 1, in which case there no longer is a fallback to
> parse_user_host_port(), so options->jump_host remains unset and the
> "Setting implicit ProxyCommand from ProxyJump" path is no longer taken
> in main().
> 
> Index: readconf.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/ssh/readconf.c,v
> retrieving revision 1.344
> diff -u -p -r1.344 readconf.c
> --- readconf.c        17 Dec 2020 23:10:27 -0000      1.344
> +++ readconf.c        20 Dec 2020 11:49:16 -0000
> @@ -2778,12 +2778,12 @@ parse_jump(const char *s, Options *o, in
>  
>               if (first) {
>                       /* First argument and configuration is active */
> -                     if (parse_ssh_uri(cp, &user, &host, &port) == -1 &&
> +                     if (parse_ssh_uri(cp, &user, &host, &port) == -1 ||
>                           parse_user_host_port(cp, &user, &host, &port) != 0)
>                               goto out;
>               } else {
>                       /* Subsequent argument or inactive configuration */
> -                     if (parse_ssh_uri(cp, NULL, NULL, NULL) == -1 &&
> +                     if (parse_ssh_uri(cp, NULL, NULL, NULL) == -1 ||
>                           parse_user_host_port(cp, NULL, NULL, NULL) != 0)
>                               goto out;
>               }
> 
> 
> ----- End forwarded message -----
> 

Reply via email to