diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2022-02-08 08:59:12 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2022-02-10 15:14:17 +1100 |
commit | 45279abceb37c3cbfac8ba36dde8b2c8cdd63d32 (patch) | |
tree | 739b13b19b03c5c8f0b65ff8188240d4f4ee68c1 /servconf.c | |
parent | a1bcbf04a7c2d81944141db7ecd0ba292d175a66 (diff) | |
download | openssh-git-45279abceb37c3cbfac8ba36dde8b2c8cdd63d32.tar.gz |
upstream: Switch hpdelim interface to accept only ":" as delimiter.
Historicallly, hpdelim accepted ":" or "/" as a port delimiter between
hosts (or addresses) and ports. These days most of the uses for "/"
are no longer accepted, so there are several places where it checks the
delimiter to disallow it. Make hpdelim accept only ":" and use hpdelim2
in the other cases. ok djm@
OpenBSD-Commit-ID: 7e6420bd1be87590b6840973f5ad5305804e3102
Diffstat (limited to 'servconf.c')
-rw-r--r-- | servconf.c | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -1,5 +1,5 @@ -/* $OpenBSD: servconf.c,v 1.382 2021/09/06 00:36:01 millert Exp $ */ +/* $OpenBSD: servconf.c,v 1.383 2022/02/08 08:59:12 dtucker Exp $ */ /* * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * All rights reserved @@ -895,7 +895,7 @@ process_permitopen_list(struct ssh *ssh, ServerOpCodes opcode, { u_int i; int port; - char *host, *arg, *oarg, ch; + char *host, *arg, *oarg; int where = opcode == sPermitOpen ? FORWARD_LOCAL : FORWARD_REMOTE; const char *what = lookup_opcode_name(opcode); @@ -913,9 +913,8 @@ process_permitopen_list(struct ssh *ssh, ServerOpCodes opcode, /* Otherwise treat it as a list of permitted host:port */ for (i = 0; i < num_opens; i++) { oarg = arg = xstrdup(opens[i]); - ch = '\0'; - host = hpdelim2(&arg, &ch); - if (host == NULL || ch == '/') + host = hpdelim(&arg); + if (host == NULL) fatal_f("missing host in %s", what); host = cleanhostname(host); if (arg == NULL || ((port = permitopen_port(arg)) < 0)) @@ -1261,7 +1260,7 @@ process_server_config_line_depth(ServerOptions *options, char *line, struct connection_info *connectinfo, int *inc_flags, int depth, struct include_list *includes) { - char ch, *str, ***chararrayptr, **charptr, *arg, *arg2, *p, *keyword; + char *str, ***chararrayptr, **charptr, *arg, *arg2, *p, *keyword; int cmdline = 0, *intptr, value, value2, n, port, oactive, r, found; SyslogFacility *log_facility_ptr; LogLevel *log_level_ptr; @@ -1380,9 +1379,8 @@ process_server_config_line_depth(ServerOptions *options, char *line, p = arg; } else { arg2 = NULL; - ch = '\0'; - p = hpdelim2(&arg, &ch); - if (p == NULL || ch == '/') + p = hpdelim(&arg); + if (p == NULL) fatal("%s line %d: bad address:port usage", filename, linenum); p = cleanhostname(p); @@ -2211,9 +2209,8 @@ process_server_config_line_depth(ServerOptions *options, char *line, xasprintf(&arg2, "*:%s", arg); } else { arg2 = xstrdup(arg); - ch = '\0'; - p = hpdelim2(&arg, &ch); - if (p == NULL || ch == '/') { + p = hpdelim(&arg); + if (p == NULL) { fatal("%s line %d: %s missing host", filename, linenum, keyword); } |