diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2019-01-23 21:50:56 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2019-01-24 12:30:30 +1100 |
commit | d05ea255678d9402beda4416cd0360f3e5dfe938 (patch) | |
tree | 90ba5b611675fe92e2938c1e5b0206183c5f42e3 /servconf.c | |
parent | 177d6c80c557a5e060cd343a0c116a2f1a7f43db (diff) |
upstream: Remove support for obsolete host/port syntax.
host/port was added in 2001 as an alternative to host:port syntax for
the benefit of IPv6 users. These days there are establised standards
for this like [::1]:22 and the slash syntax is easily mistaken for CIDR
notation, which OpenSSH now supports for some things. Remove the slash
notation from ListenAddress and PermitOpen. bz#2335, patch from jjelen
at redhat.com, ok markus@
OpenBSD-Commit-ID: fae5f4e23c51a368d6b2d98376069ac2b10ad4b7
Diffstat (limited to 'servconf.c')
-rw-r--r-- | servconf.c | 20 |
1 files changed, 12 insertions, 8 deletions
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)); |