summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2016-07-06 19:29:13 +0000
committermillert <millert@openbsd.org>2016-07-06 19:29:13 +0000
commit400ff17950f1b47055c4e81a5bbd2d0373a41759 (patch)
tree2070a958c6057bbf88bdc69fb79ccd27a5547b1c
parentReturn EINVAL for mknod/mknodat when dev is -1 (aka VNOVAL). (diff)
downloadwireguard-openbsd-400ff17950f1b47055c4e81a5bbd2d0373a41759.tar.xz
wireguard-openbsd-400ff17950f1b47055c4e81a5bbd2d0373a41759.zip
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.
-rw-r--r--usr.sbin/syslogd/syslog.conf.510
-rw-r--r--usr.sbin/syslogd/syslogd.c16
2 files changed, 15 insertions, 11 deletions
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) {