summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2016-07-22 03:35:11 +0000
committerDamien Miller <djm@mindrot.org>2016-07-22 13:36:40 +1000
commit286f5a77c3bfec1e8892ca268087ac885ac871bf (patch)
treea7f1746402ed9b36ab0d9a099063742022f4ef19
parentfcd135c9df440bcd2d5870405ad3311743d78d97 (diff)
upstream commit
reverse the order in which -J/JumpHost proxies are visited to be more intuitive and document reported by and manpage bits naddy@ Upstream-ID: 3a68fd6a841fd6cf8cedf6552a9607ba99df179a
-rw-r--r--readconf.c25
-rw-r--r--ssh_config.57
2 files changed, 20 insertions, 12 deletions
diff --git a/readconf.c b/readconf.c
index 8b5b21907..c177202b1 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.258 2016/07/20 10:45:27 naddy Exp $ */ 1/* $OpenBSD: readconf.c,v 1.259 2016/07/22 03:35:11 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -2292,7 +2292,12 @@ parse_jump(const char *s, Options *o, int active)
2292 2292
2293 orig = sdup = xstrdup(s); 2293 orig = sdup = xstrdup(s);
2294 first = active; 2294 first = active;
2295 while ((cp = strsep(&sdup, ",")) && cp != NULL) { 2295 do {
2296 if ((cp = strrchr(sdup, ',')) == NULL)
2297 cp = sdup; /* last */
2298 else
2299 *cp++ = '\0';
2300
2296 if (first) { 2301 if (first) {
2297 /* First argument and configuration is active */ 2302 /* First argument and configuration is active */
2298 if (parse_user_host_port(cp, &user, &host, &port) != 0) 2303 if (parse_user_host_port(cp, &user, &host, &port) != 0)
@@ -2303,7 +2308,7 @@ parse_jump(const char *s, Options *o, int active)
2303 goto out; 2308 goto out;
2304 } 2309 }
2305 first = 0; /* only check syntax for subsequent hosts */ 2310 first = 0; /* only check syntax for subsequent hosts */
2306 } 2311 } while (cp != sdup);
2307 /* success */ 2312 /* success */
2308 if (active) { 2313 if (active) {
2309 o->jump_user = user; 2314 o->jump_user = user;
@@ -2311,8 +2316,10 @@ parse_jump(const char *s, Options *o, int active)
2311 o->jump_port = port; 2316 o->jump_port = port;
2312 o->proxy_command = xstrdup("none"); 2317 o->proxy_command = xstrdup("none");
2313 user = host = NULL; 2318 user = host = NULL;
2314 if ((cp = strchr(s, ',')) != NULL && cp[1] != '\0') 2319 if ((cp = strrchr(s, ',')) != NULL && cp != s) {
2315 o->jump_extra = xstrdup(cp + 1); 2320 o->jump_extra = xstrdup(s);
2321 o->jump_extra[cp - s] = '\0';
2322 }
2316 } 2323 }
2317 ret = 0; 2324 ret = 0;
2318 out: 2325 out:
@@ -2636,6 +2643,9 @@ dump_client_config(Options *o, const char *host)
2636 strspn(o->jump_host, "1234567890.") == strlen(o->jump_host); 2643 strspn(o->jump_host, "1234567890.") == strlen(o->jump_host);
2637 snprintf(buf, sizeof(buf), "%d", o->jump_port); 2644 snprintf(buf, sizeof(buf), "%d", o->jump_port);
2638 printf("proxyjump %s%s%s%s%s%s%s%s%s\n", 2645 printf("proxyjump %s%s%s%s%s%s%s%s%s\n",
2646 /* optional additional jump spec */
2647 o->jump_extra == NULL ? "" : o->jump_extra,
2648 o->jump_extra == NULL ? "" : ",",
2639 /* optional user */ 2649 /* optional user */
2640 o->jump_user == NULL ? "" : o->jump_user, 2650 o->jump_user == NULL ? "" : o->jump_user,
2641 o->jump_user == NULL ? "" : "@", 2651 o->jump_user == NULL ? "" : "@",
@@ -2647,9 +2657,6 @@ dump_client_config(Options *o, const char *host)
2647 i ? "]" : "", 2657 i ? "]" : "",
2648 /* optional port number */ 2658 /* optional port number */
2649 o->jump_port <= 0 ? "" : ":", 2659 o->jump_port <= 0 ? "" : ":",
2650 o->jump_port <= 0 ? "" : buf, 2660 o->jump_port <= 0 ? "" : buf);
2651 /* optional additional jump spec */
2652 o->jump_extra == NULL ? "" : ",",
2653 o->jump_extra == NULL ? "" : o->jump_extra);
2654 } 2661 }
2655} 2662}
diff --git a/ssh_config.5 b/ssh_config.5
index 56d7798ca..fd7af4b62 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -33,8 +33,8 @@
33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 33.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35.\" 35.\"
36.\" $OpenBSD: ssh_config.5,v 1.234 2016/07/16 06:57:55 jmc Exp $ 36.\" $OpenBSD: ssh_config.5,v 1.235 2016/07/22 03:35:11 djm Exp $
37.Dd $Mdocdate: July 16 2016 $ 37.Dd $Mdocdate: July 22 2016 $
38.Dt SSH_CONFIG 5 38.Dt SSH_CONFIG 5
39.Os 39.Os
40.Sh NAME 40.Sh NAME
@@ -1367,7 +1367,8 @@ Specifies one or more jump proxies as
1367.Op : Ns Ar port 1367.Op : Ns Ar port
1368.Sm on 1368.Sm on
1369.Xc . 1369.Xc .
1370Multiple proxies may be separated by comma characters. 1370Multiple proxies may be separated by comma characters and will be visited
1371left-to-right.
1371Setting this option will cause 1372Setting this option will cause
1372.Xr ssh 1 1373.Xr ssh 1
1373to connect to the target host by first making a 1374to connect to the target host by first making a