summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-06-19 02:59:41 +0000
committerDamien Miller <djm@mindrot.org>2018-06-19 13:00:50 +1000
commit87ddd676da0f3abd08b778b12b53b91b670dc93c (patch)
tree57bf11cf56aeddffdafdc97b74d7bc632c317df7 /servconf.c
parent26f96ca10ad0ec5da9b05b99de1e1ccea15a11be (diff)
upstream: allow bare port numbers to appear in PermitListen directives,
e.g. PermitListen 2222 8080 is equivalent to: PermitListen *:2222 *:8080 Some bonus manpage improvements, mostly from markus@ "looks fine" markus@ OpenBSD-Commit-ID: 6546b0cc5aab7f53d65ad0a348ca0ae591d6dd24
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/servconf.c b/servconf.c
index 6e70e6312..cb5786583 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,5 +1,5 @@
1 1
2/* $OpenBSD: servconf.c,v 1.332 2018/06/09 03:03:10 djm Exp $ */ 2/* $OpenBSD: servconf.c,v 1.333 2018/06/19 02:59:41 djm 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
@@ -1870,15 +1870,23 @@ process_server_config_line(ServerOptions *options, char *line,
1870 break; 1870 break;
1871 } 1871 }
1872 for (; arg != NULL && *arg != '\0'; arg = strdelim(&cp)) { 1872 for (; arg != NULL && *arg != '\0'; arg = strdelim(&cp)) {
1873 arg2 = xstrdup(arg); 1873 if (opcode == sPermitListen &&
1874 p = hpdelim(&arg); 1874 strchr(arg, ':') == NULL) {
1875 /* XXX support bare port number for PermitListen */ 1875 /*
1876 if (p == NULL) { 1876 * Allow bare port number for PermitListen
1877 fatal("%s line %d: missing host in %s", 1877 * to indicate a wildcard listen host.
1878 filename, linenum, 1878 */
1879 lookup_opcode_name(opcode)); 1879 xasprintf(&arg2, "*:%s", arg);
1880 } else {
1881 arg2 = xstrdup(arg);
1882 p = hpdelim(&arg);
1883 if (p == NULL) {
1884 fatal("%s line %d: missing host in %s",
1885 filename, linenum,
1886 lookup_opcode_name(opcode));
1887 }
1888 p = cleanhostname(p);
1880 } 1889 }
1881 p = cleanhostname(p);
1882 if (arg == NULL || 1890 if (arg == NULL ||
1883 ((port = permitopen_port(arg)) < 0)) { 1891 ((port = permitopen_port(arg)) < 0)) {
1884 fatal("%s line %d: bad port number in %s", 1892 fatal("%s line %d: bad port number in %s",