diff options
-rw-r--r-- | readconf.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/readconf.c b/readconf.c index cb2999d82..8b5b21907 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.257 2016/07/15 00:24:30 djm Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.258 2016/07/20 10:45:27 naddy 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 |
@@ -2286,13 +2286,14 @@ parse_jump(const char *s, Options *o, int active) | |||
2286 | { | 2286 | { |
2287 | char *orig, *sdup, *cp; | 2287 | char *orig, *sdup, *cp; |
2288 | char *host = NULL, *user = NULL; | 2288 | char *host = NULL, *user = NULL; |
2289 | int ret = -1, port = -1; | 2289 | int ret = -1, port = -1, first; |
2290 | 2290 | ||
2291 | active &= o->proxy_command == NULL && o->jump_host == NULL; | 2291 | active &= o->proxy_command == NULL && o->jump_host == NULL; |
2292 | 2292 | ||
2293 | orig = sdup = xstrdup(s); | 2293 | orig = sdup = xstrdup(s); |
2294 | first = active; | ||
2294 | while ((cp = strsep(&sdup, ",")) && cp != NULL) { | 2295 | while ((cp = strsep(&sdup, ",")) && cp != NULL) { |
2295 | if (active) { | 2296 | if (first) { |
2296 | /* First argument and configuration is active */ | 2297 | /* First argument and configuration is active */ |
2297 | if (parse_user_host_port(cp, &user, &host, &port) != 0) | 2298 | if (parse_user_host_port(cp, &user, &host, &port) != 0) |
2298 | goto out; | 2299 | goto out; |
@@ -2301,19 +2302,21 @@ parse_jump(const char *s, Options *o, int active) | |||
2301 | if (parse_user_host_port(cp, NULL, NULL, NULL) != 0) | 2302 | if (parse_user_host_port(cp, NULL, NULL, NULL) != 0) |
2302 | goto out; | 2303 | goto out; |
2303 | } | 2304 | } |
2304 | active = 0; /* only check syntax for subsequent hosts */ | 2305 | first = 0; /* only check syntax for subsequent hosts */ |
2305 | } | 2306 | } |
2306 | /* success */ | 2307 | /* success */ |
2307 | free(orig); | 2308 | if (active) { |
2308 | o->jump_user = user; | 2309 | o->jump_user = user; |
2309 | o->jump_host = host; | 2310 | o->jump_host = host; |
2310 | o->jump_port = port; | 2311 | o->jump_port = port; |
2311 | o->proxy_command = xstrdup("none"); | 2312 | o->proxy_command = xstrdup("none"); |
2312 | user = host = NULL; | 2313 | user = host = NULL; |
2313 | if ((cp = strchr(s, ',')) != NULL && cp[1] != '\0') | 2314 | if ((cp = strchr(s, ',')) != NULL && cp[1] != '\0') |
2314 | o->jump_extra = xstrdup(cp + 1); | 2315 | o->jump_extra = xstrdup(cp + 1); |
2316 | } | ||
2315 | ret = 0; | 2317 | ret = 0; |
2316 | out: | 2318 | out: |
2319 | free(orig); | ||
2317 | free(user); | 2320 | free(user); |
2318 | free(host); | 2321 | free(host); |
2319 | return ret; | 2322 | return ret; |