summaryrefslogtreecommitdiffstats
path: root/contrib/tcp_wrappers
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2010-01-08 10:54:15 +0000
committersobomax <sobomax@FreeBSD.org>2010-01-08 10:54:15 +0000
commite083f90a62ed1a0d30ee8d515182bd182456d226 (patch)
tree09795ec15910f9fc0c3355a765ed019ab3fb6599 /contrib/tcp_wrappers
parent3fca010e760598a412eda4a8697526ab2af65d1f (diff)
downloadFreeBSD-src-e083f90a62ed1a0d30ee8d515182bd182456d226.zip
FreeBSD-src-e083f90a62ed1a0d30ee8d515182bd182456d226.tar.gz
Allow comment (#) to be placed anywhere in the line, not only at the
beginning, so it's consistent with other configuration files. MFC after: 3 weeks
Diffstat (limited to 'contrib/tcp_wrappers')
-rw-r--r--contrib/tcp_wrappers/hosts_access.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/tcp_wrappers/hosts_access.c b/contrib/tcp_wrappers/hosts_access.c
index 8220e64..03d305b 100644
--- a/contrib/tcp_wrappers/hosts_access.c
+++ b/contrib/tcp_wrappers/hosts_access.c
@@ -148,6 +148,7 @@ struct request_info *request;
char *sh_cmd; /* becomes optional shell command */
int match = NO;
struct tcpd_context saved_context;
+ char *cp;
saved_context = tcpd_context; /* stupid compilers */
@@ -164,7 +165,16 @@ struct request_info *request;
tcpd_warn("missing newline or line too long");
continue;
}
- if (sv_list[0] == '#' || sv_list[strspn(sv_list, " \t\r\n")] == 0)
+ /* Ignore anything after unescaped # character */
+ for (cp = strchr(sv_list, '#'); cp != NULL;) {
+ if (cp > sv_list && cp[-1] == '\\') {
+ cp = strchr(cp + 1, '#');
+ continue;
+ }
+ *cp = '\0';
+ break;
+ }
+ if (sv_list[strspn(sv_list, " \t\r\n")] == 0)
continue;
if ((cl_list = split_at(sv_list, ':')) == 0) {
tcpd_warn("missing \":\" separator");
OpenPOWER on IntegriCloud