diff options
-rw-r--r-- | misc.c | 4 | ||||
-rw-r--r-- | misc.h | 3 | ||||
-rw-r--r-- | servconf.c | 20 |
3 files changed, 16 insertions, 11 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.c,v 1.136 2018/12/27 03:25:25 djm Exp $ */ | 1 | /* $OpenBSD: misc.c,v 1.137 2019/01/23 21:50:56 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. |
@@ -564,7 +564,7 @@ put_host_port(const char *host, u_short port) | |||
564 | * The delimiter char, if present, is stored in delim. | 564 | * The delimiter char, if present, is stored in delim. |
565 | * If this is the last field, *cp is set to NULL. | 565 | * If this is the last field, *cp is set to NULL. |
566 | */ | 566 | */ |
567 | static char * | 567 | char * |
568 | hpdelim2(char **cp, char *delim) | 568 | hpdelim2(char **cp, char *delim) |
569 | { | 569 | { |
570 | char *s, *old; | 570 | char *s, *old; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.h,v 1.78 2018/12/27 03:25:25 djm Exp $ */ | 1 | /* $OpenBSD: misc.h,v 1.79 2019/01/23 21:50:56 dtucker Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -57,6 +57,7 @@ int timeout_connect(int, const struct sockaddr *, socklen_t, int *); | |||
57 | int a2port(const char *); | 57 | int a2port(const char *); |
58 | int a2tun(const char *, int *); | 58 | int a2tun(const char *, int *); |
59 | char *put_host_port(const char *, u_short); | 59 | char *put_host_port(const char *, u_short); |
60 | char *hpdelim2(char **, char *); | ||
60 | char *hpdelim(char **); | 61 | char *hpdelim(char **); |
61 | char *cleanhostname(char *); | 62 | char *cleanhostname(char *); |
62 | char *colon(char *); | 63 | char *colon(char *); |
diff --git a/servconf.c b/servconf.c index 86c631bb0..1562bd875 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | /* $OpenBSD: servconf.c,v 1.346 2019/01/19 21:37:48 djm Exp $ */ | 2 | /* $OpenBSD: servconf.c,v 1.347 2019/01/23 21:50:56 dtucker Exp $ */ |
3 | /* | 3 | /* |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
5 | * All rights reserved | 5 | * All rights reserved |
@@ -878,7 +878,7 @@ process_permitopen_list(struct ssh *ssh, ServerOpCodes opcode, | |||
878 | { | 878 | { |
879 | u_int i; | 879 | u_int i; |
880 | int port; | 880 | int port; |
881 | char *host, *arg, *oarg; | 881 | char *host, *arg, *oarg, ch; |
882 | int where = opcode == sPermitOpen ? FORWARD_LOCAL : FORWARD_REMOTE; | 882 | int where = opcode == sPermitOpen ? FORWARD_LOCAL : FORWARD_REMOTE; |
883 | const char *what = lookup_opcode_name(opcode); | 883 | const char *what = lookup_opcode_name(opcode); |
884 | 884 | ||
@@ -896,8 +896,8 @@ process_permitopen_list(struct ssh *ssh, ServerOpCodes opcode, | |||
896 | /* Otherwise treat it as a list of permitted host:port */ | 896 | /* Otherwise treat it as a list of permitted host:port */ |
897 | for (i = 0; i < num_opens; i++) { | 897 | for (i = 0; i < num_opens; i++) { |
898 | oarg = arg = xstrdup(opens[i]); | 898 | oarg = arg = xstrdup(opens[i]); |
899 | host = hpdelim(&arg); | 899 | host = hpdelim2(&arg, &ch); |
900 | if (host == NULL) | 900 | if (host == NULL || ch == '/') |
901 | fatal("%s: missing host in %s", __func__, what); | 901 | fatal("%s: missing host in %s", __func__, what); |
902 | host = cleanhostname(host); | 902 | host = cleanhostname(host); |
903 | if (arg == NULL || ((port = permitopen_port(arg)) < 0)) | 903 | if (arg == NULL || ((port = permitopen_port(arg)) < 0)) |
@@ -1314,8 +1314,10 @@ process_server_config_line(ServerOptions *options, char *line, | |||
1314 | port = 0; | 1314 | port = 0; |
1315 | p = arg; | 1315 | p = arg; |
1316 | } else { | 1316 | } else { |
1317 | p = hpdelim(&arg); | 1317 | char ch; |
1318 | if (p == NULL) | 1318 | arg2 = NULL; |
1319 | p = hpdelim2(&arg, &ch); | ||
1320 | if (p == NULL || ch == '/') | ||
1319 | fatal("%s line %d: bad address:port usage", | 1321 | fatal("%s line %d: bad address:port usage", |
1320 | filename, linenum); | 1322 | filename, linenum); |
1321 | p = cleanhostname(p); | 1323 | p = cleanhostname(p); |
@@ -1942,9 +1944,11 @@ process_server_config_line(ServerOptions *options, char *line, | |||
1942 | */ | 1944 | */ |
1943 | xasprintf(&arg2, "*:%s", arg); | 1945 | xasprintf(&arg2, "*:%s", arg); |
1944 | } else { | 1946 | } else { |
1947 | char ch; | ||
1948 | |||
1945 | arg2 = xstrdup(arg); | 1949 | arg2 = xstrdup(arg); |
1946 | p = hpdelim(&arg); | 1950 | p = hpdelim2(&arg, &ch); |
1947 | if (p == NULL) { | 1951 | if (p == NULL || ch == '/') { |
1948 | fatal("%s line %d: missing host in %s", | 1952 | fatal("%s line %d: missing host in %s", |
1949 | filename, linenum, | 1953 | filename, linenum, |
1950 | lookup_opcode_name(opcode)); | 1954 | lookup_opcode_name(opcode)); |