From: millert Date: Wed, 6 Jul 2016 19:29:13 +0000 (+0000) Subject: Allow space-deliminated fields in syslog.conf in addition to X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=400ff17950f1b47055c4e81a5bbd2d0373a41759;p=openbsd Allow space-deliminated fields in syslog.conf in addition to traditional tabs-deliminated fields. This is consistent with what FreeBSD, NetBSD and Linux do. Adapted from FreeBSD. --- diff --git a/usr.sbin/syslogd/syslog.conf.5 b/usr.sbin/syslogd/syslog.conf.5 index 98c684a712f..28029f8a157 100644 --- a/usr.sbin/syslogd/syslog.conf.5 +++ b/usr.sbin/syslogd/syslog.conf.5 @@ -26,10 +26,10 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)syslog.conf.5 8.1 (Berkeley) 6/9/93 -.\" $OpenBSD: syslog.conf.5,v 1.33 2015/09/10 15:16:44 schwarze Exp $ +.\" $OpenBSD: syslog.conf.5,v 1.34 2016/07/06 19:29:13 millert Exp $ .\" $NetBSD: syslog.conf.5,v 1.4 1996/01/02 17:41:46 perry Exp $ .\" -.Dd $Mdocdate: September 10 2015 $ +.Dd $Mdocdate: July 6 2016 $ .Dt SYSLOG.CONF 5 .Os .Sh NAME @@ -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 diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index a3f83d614d3..881fe0b79c0 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.c,v 1.207 2016/07/01 15:47:15 millert Exp $ */ +/* $OpenBSD: syslogd.c,v 1.208 2016/07/06 19:29:13 millert Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -2454,19 +2454,19 @@ cfline(char *line, char *progblock, char *hostblock) 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 *hostblock) } /* 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 *hostblock) } /* skip to action part */ - while (*p == '\t') + while (*p == '\t' || *p == ' ') p++; switch (*p) {