summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-05-22 00:13:26 +0000
committerDamien Miller <djm@mindrot.org>2018-05-22 10:15:18 +1000
commit4b22fd8ecefd059a66140be67f352eb6145a9d88 (patch)
treed85605c4323f2a1946dca71fcf2f86162d17f497
parentf41bcd70f55b4f0fc4d8e1039cb361ac922b23fb (diff)
upstream: support ProxyJump=none to disable ProxyJump
functionality; bz#2869 ok dtucker@ OpenBSD-Commit-ID: 1c06ee08eb78451b5837fcfd8cbebc5ff3a67a01
-rw-r--r--readconf.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/readconf.c b/readconf.c
index 5a1055bcb..7b7a0d7e0 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readconf.c,v 1.286 2018/04/06 13:02:39 djm Exp $ */ 1/* $OpenBSD: readconf.c,v 1.287 2018/05/22 00:13:26 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
@@ -2072,6 +2072,12 @@ fill_default_options(Options * options)
2072 CLEAR_ON_NONE(options->proxy_command); 2072 CLEAR_ON_NONE(options->proxy_command);
2073 CLEAR_ON_NONE(options->control_path); 2073 CLEAR_ON_NONE(options->control_path);
2074 CLEAR_ON_NONE(options->revoked_host_keys); 2074 CLEAR_ON_NONE(options->revoked_host_keys);
2075 if (options->jump_host != NULL &&
2076 strcmp(options->jump_host, "none") == 0 &&
2077 options->jump_port == 0 && options->jump_user == NULL) {
2078 free(options->jump_host);
2079 options->jump_host = NULL;
2080 }
2075 /* options->identity_agent distinguishes NULL from 'none' */ 2081 /* options->identity_agent distinguishes NULL from 'none' */
2076 /* options->user will be set in the main program if appropriate */ 2082 /* options->user will be set in the main program if appropriate */
2077 /* options->hostname will be set in the main program if appropriate */ 2083 /* options->hostname will be set in the main program if appropriate */
@@ -2300,6 +2306,8 @@ parse_jump(const char *s, Options *o, int active)
2300 orig = sdup = xstrdup(s); 2306 orig = sdup = xstrdup(s);
2301 first = active; 2307 first = active;
2302 do { 2308 do {
2309 if (strcasecmp(s, "none") == 0)
2310 break;
2303 if ((cp = strrchr(sdup, ',')) == NULL) 2311 if ((cp = strrchr(sdup, ',')) == NULL)
2304 cp = sdup; /* last */ 2312 cp = sdup; /* last */
2305 else 2313 else
@@ -2320,14 +2328,19 @@ parse_jump(const char *s, Options *o, int active)
2320 } while (cp != sdup); 2328 } while (cp != sdup);
2321 /* success */ 2329 /* success */
2322 if (active) { 2330 if (active) {
2323 o->jump_user = user; 2331 if (strcasecmp(s, "none") == 0) {
2324 o->jump_host = host; 2332 o->jump_host = xstrdup("none");
2325 o->jump_port = port; 2333 o->jump_port = 0;
2326 o->proxy_command = xstrdup("none"); 2334 } else {
2327 user = host = NULL; 2335 o->jump_user = user;
2328 if ((cp = strrchr(s, ',')) != NULL && cp != s) { 2336 o->jump_host = host;
2329 o->jump_extra = xstrdup(s); 2337 o->jump_port = port;
2330 o->jump_extra[cp - s] = '\0'; 2338 o->proxy_command = xstrdup("none");
2339 user = host = NULL;
2340 if ((cp = strrchr(s, ',')) != NULL && cp != s) {
2341 o->jump_extra = xstrdup(s);
2342 o->jump_extra[cp - s] = '\0';
2343 }
2331 } 2344 }
2332 } 2345 }
2333 ret = 0; 2346 ret = 0;