git: 0edafb4cfbbd - stable/15 - syslogd: Improve handling of configuration errors
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 31 Mar 2026 15:58:49 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=0edafb4cfbbd43ae9f5c4758a2872df1794e208e
commit 0edafb4cfbbd43ae9f5c4758a2872df1794e208e
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-02-16 19:50:45 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-03-31 15:57:28 +0000
syslogd: Improve handling of configuration errors
Make parse_selector() print a warning to stderr and continue parsing the
config if it encounters an invalid facility or priority. Note that
because the parsing is done from a casper service, there isn't a good
mechanism to log errors; the warnings are visible only when syslogd is
started in debug mode.
Reported by: Doug Hardie <bc979@lafn.org>
MFC after: 1 week
Fixes: f4b4a10abb26 ("syslogd: Move selector parsing into its own function")
Reviewed by: jfree, jlduran, eugen, delphij
Differential Revision: https://reviews.freebsd.org/D55033
(cherry picked from commit 29ec3907f193e205a1c2118c182ec43e51baf717)
---
usr.sbin/syslogd/syslogd.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 972b64ed732e..20051bb4fa00 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -2930,8 +2930,9 @@ parse_selector(const char *p, struct filed *f)
pri = decode(buf, prioritynames);
if (pri < 0) {
- dprintf("unknown priority name \"%s\"", buf);
- return (NULL);
+ warnx("unknown priority name \"%s\", setting to 'info'",
+ buf);
+ pri = LOG_INFO;
}
}
if (!pri_cmp)
@@ -2953,11 +2954,12 @@ parse_selector(const char *p, struct filed *f)
} else {
i = decode(buf, facilitynames);
if (i < 0) {
- dprintf("unknown facility name \"%s\"", buf);
- return (NULL);
+ warnx("unknown facility name \"%s\", ignoring",
+ buf);
+ } else {
+ f->f_pmask[i >> 3] = pri;
+ f->f_pcmp[i >> 3] = pri_cmp;
}
- f->f_pmask[i >> 3] = pri;
- f->f_pcmp[i >> 3] = pri_cmp;
}
while (*p == ',' || *p == ' ')
p++;