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
This commit is contained in:
Maxim Sobolev 2010-01-08 10:54:15 +00:00
parent 51d930e747
commit d594463f1b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=201782

View file

@ -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");