summaryrefslogtreecommitdiffstats
path: root/servconf.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-06-19 04:59:41 +0200
committerDamien Miller <djm@mindrot.org>2018-06-19 05:00:50 +0200
commit87ddd676da0f3abd08b778b12b53b91b670dc93c (patch)
tree57bf11cf56aeddffdafdc97b74d7bc632c317df7 /servconf.c
parentupstream: invalidate supplemental group cache used by (diff)
downloadopenssh-87ddd676da0f3abd08b778b12b53b91b670dc93c.tar.xz
openssh-87ddd676da0f3abd08b778b12b53b91b670dc93c.zip
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 @@
-/* $OpenBSD: servconf.c,v 1.332 2018/06/09 03:03:10 djm Exp $ */
+/* $OpenBSD: servconf.c,v 1.333 2018/06/19 02:59:41 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -1870,15 +1870,23 @@ process_server_config_line(ServerOptions *options, char *line,
break;
}
for (; arg != NULL && *arg != '\0'; arg = strdelim(&cp)) {
- arg2 = xstrdup(arg);
- p = hpdelim(&arg);
- /* XXX support bare port number for PermitListen */
- if (p == NULL) {
- fatal("%s line %d: missing host in %s",
- filename, linenum,
- lookup_opcode_name(opcode));
+ if (opcode == sPermitListen &&
+ strchr(arg, ':') == NULL) {
+ /*
+ * Allow bare port number for PermitListen
+ * to indicate a wildcard listen host.
+ */
+ xasprintf(&arg2, "*:%s", arg);
+ } else {
+ arg2 = xstrdup(arg);
+ p = hpdelim(&arg);
+ if (p == NULL) {
+ fatal("%s line %d: missing host in %s",
+ filename, linenum,
+ lookup_opcode_name(opcode));
+ }
+ p = cleanhostname(p);
}
- p = cleanhostname(p);
if (arg == NULL ||
((port = permitopen_port(arg)) < 0)) {
fatal("%s line %d: bad port number in %s",