diff options
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/readconf.c b/readconf.c index 4f38b27cf..f63894f9c 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.278 2017/09/03 23:33:13 djm Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.279 2017/09/21 19:16:53 markus 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 |
@@ -836,6 +836,7 @@ process_config_line_depth(Options *options, struct passwd *pw, const char *host, | |||
836 | char **cpptr, fwdarg[256]; | 836 | char **cpptr, fwdarg[256]; |
837 | u_int i, *uintptr, max_entries = 0; | 837 | u_int i, *uintptr, max_entries = 0; |
838 | int r, oactive, negated, opcode, *intptr, value, value2, cmdline = 0; | 838 | int r, oactive, negated, opcode, *intptr, value, value2, cmdline = 0; |
839 | int remotefwd, dynamicfwd; | ||
839 | LogLevel *log_level_ptr; | 840 | LogLevel *log_level_ptr; |
840 | SyslogFacility *log_facility_ptr; | 841 | SyslogFacility *log_facility_ptr; |
841 | long long val64; | 842 | long long val64; |
@@ -1255,31 +1256,36 @@ parse_keytypes: | |||
1255 | fatal("%.200s line %d: Missing port argument.", | 1256 | fatal("%.200s line %d: Missing port argument.", |
1256 | filename, linenum); | 1257 | filename, linenum); |
1257 | 1258 | ||
1258 | if (opcode == oLocalForward || | 1259 | remotefwd = (opcode == oRemoteForward); |
1259 | opcode == oRemoteForward) { | 1260 | dynamicfwd = (opcode == oDynamicForward); |
1260 | arg2 = strdelim(&s); | ||
1261 | if (arg2 == NULL || *arg2 == '\0') | ||
1262 | fatal("%.200s line %d: Missing target argument.", | ||
1263 | filename, linenum); | ||
1264 | 1261 | ||
1265 | /* construct a string for parse_forward */ | 1262 | if (!dynamicfwd) { |
1266 | snprintf(fwdarg, sizeof(fwdarg), "%s:%s", arg, arg2); | 1263 | arg2 = strdelim(&s); |
1267 | } else if (opcode == oDynamicForward) { | 1264 | if (arg2 == NULL || *arg2 == '\0') { |
1268 | strlcpy(fwdarg, arg, sizeof(fwdarg)); | 1265 | if (remotefwd) |
1266 | dynamicfwd = 1; | ||
1267 | else | ||
1268 | fatal("%.200s line %d: Missing target " | ||
1269 | "argument.", filename, linenum); | ||
1270 | } else { | ||
1271 | /* construct a string for parse_forward */ | ||
1272 | snprintf(fwdarg, sizeof(fwdarg), "%s:%s", arg, | ||
1273 | arg2); | ||
1274 | } | ||
1269 | } | 1275 | } |
1276 | if (dynamicfwd) | ||
1277 | strlcpy(fwdarg, arg, sizeof(fwdarg)); | ||
1270 | 1278 | ||
1271 | if (parse_forward(&fwd, fwdarg, | 1279 | if (parse_forward(&fwd, fwdarg, dynamicfwd, remotefwd) == 0) |
1272 | opcode == oDynamicForward ? 1 : 0, | ||
1273 | opcode == oRemoteForward ? 1 : 0) == 0) | ||
1274 | fatal("%.200s line %d: Bad forwarding specification.", | 1280 | fatal("%.200s line %d: Bad forwarding specification.", |
1275 | filename, linenum); | 1281 | filename, linenum); |
1276 | 1282 | ||
1277 | if (*activep) { | 1283 | if (*activep) { |
1278 | if (opcode == oLocalForward || | 1284 | if (remotefwd) { |
1279 | opcode == oDynamicForward) | ||
1280 | add_local_forward(options, &fwd); | ||
1281 | else if (opcode == oRemoteForward) | ||
1282 | add_remote_forward(options, &fwd); | 1285 | add_remote_forward(options, &fwd); |
1286 | } else { | ||
1287 | add_local_forward(options, &fwd); | ||
1288 | } | ||
1283 | } | 1289 | } |
1284 | break; | 1290 | break; |
1285 | 1291 | ||