----- Original Message -----
> From: "Todd C. Miller" <[email protected]>
> To: "tech" <[email protected]>
> Sent: Friday, July 1, 2016 12:55:11 PM
> Subject: syslogd: accept space-deliminated fields

> Linux, Net and Free also support space-deliminated fields. Maybe
> we should too...

> - todd

> Index: usr.sbin/syslogd/syslog.conf.5
> ===================================================================
> RCS file: /cvs/src/usr.sbin/syslogd/syslog.conf.5,v
> retrieving revision 1.33
> diff -u -p -u -r1.33 syslog.conf.5
> --- usr.sbin/syslogd/syslog.conf.5 10 Sep 2015 15:16:44 -0000 1.33
> +++ usr.sbin/syslogd/syslog.conf.5 1 Jul 2016 16:50:37 -0000
> @@ -55,7 +55,7 @@ The
> .Em selector
> field is separated from the
> .Em action
> -field by one or more tab characters.
> +field by one or more tab or space characters.
> .Pp
> The
> .Em selectors
> @@ -334,6 +334,10 @@ file appeared in
> .Bx 4.3 ,
> along with
> .Xr syslogd 8 .
> +.Pp
> +Historic versions of
> +.Xr syslogd 8
> +did not support space-delimited fields.
> .Sh BUGS
> The effects of multiple selectors are sometimes not intuitive.
> For example
> Index: usr.sbin/syslogd/syslogd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v
> retrieving revision 1.207
> diff -u -p -u -r1.207 syslogd.c
> --- usr.sbin/syslogd/syslogd.c 1 Jul 2016 15:47:15 -0000 1.207
> +++ usr.sbin/syslogd/syslogd.c 1 Jul 2016 16:50:37 -0000
> @@ -2454,19 +2454,19 @@ cfline(char *line, char *progblock, char
> f->f_hostname = strdup(hostblock);

> /* scan through the list of selectors */
> - for (p = line; *p && *p != '\t';) {
> + for (p = line; *p && *p != '\t' && *p != ' ';) {

> /* find the end of this facility name list */
> - for (q = p; *q && *q != '\t' && *q++ != '.'; )
> + for (q = p; *q && *q != '\t' && *q != ' ' && *q++ != '.'; )
> continue;

> /* collect priority name */
> - for (bp = buf; *q && !strchr("\t,;", *q); )
> + for (bp = buf; *q && !strchr("\t,; ", *q); )
> *bp++ = *q++;
> *bp = '\0';

> /* skip cruft */
> - while (*q && strchr(", ;", *q))
> + while (*q && strchr(",;", *q))
> q++;

> /* decode priority name */
> @@ -2489,8 +2489,8 @@ cfline(char *line, char *progblock, char
> }

> /* scan facilities */
> - while (*p && !strchr("\t.;", *p)) {
> - for (bp = buf; *p && !strchr("\t,;.", *p); )
> + while (*p && !strchr("\t.; ", *p)) {
> + for (bp = buf; *p && !strchr("\t,;. ", *p); )
> *bp++ = *p++;
> *bp = '\0';
> if (*buf == '*')
> @@ -2516,7 +2516,7 @@ cfline(char *line, char *progblock, char
> }

> /* skip to action part */
> - while (*p == '\t')
> + while (*p == '\t' || *p == ' ')
> p++;

> switch (*p) {

This passed some basic testing on my end. Thanks!

Rob

Reply via email to