]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
newsyslog(8): make configuration parser more robust.
authorEugene Grosbein <eugen@FreeBSD.org>
Tue, 16 Jun 2020 17:45:23 +0000 (17:45 +0000)
committerEugene Grosbein <eugen@FreeBSD.org>
Tue, 16 Jun 2020 17:45:23 +0000 (17:45 +0000)
commit01cf0a1724464a182024dce9bd6219b3c2947b63
treec0d5c0838288f96a764d3d9de252e991af1dce00
parenta9c7e6bd61a7073fa4bc45fdc82713c3a8ef0208
newsyslog(8): make configuration parser more robust.

Currently newsyslog supports <include> directive that is used
in our default /etc/newsyslog.conf in the following form:

<include> /usr/local/etc/newsyslog.conf.d/*

While this is suitable for ports installing their own rules
for logs rotation, this also makes newsyslog break entire
processing of all files if it encounters single line it cannot parse.
This includes lines referring to nonexistent username/group for log
ownership, so newsyslog stops calling errx() function in the parser.

With this fix, newsyslog uses warnx() instead of errx() in such cases
to print a warning, recover gracefully and continue with execution.

Among other cases, this unbreaks initial creation of log files
having flag "C" at boot time (newsyslog -CN). This is most important
for systems having RAM-based /var file system like nanobsd(8)-based
that rely on newsyslog to bring system log files into existence.

MFC after: 1 month
usr.sbin/newsyslog/newsyslog.c