Date: Wed, 22 Apr 1998 11:21:38 -0700 (PDT) From: Joseph Stein <joes@shasta.wstein.com> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: docs/6385: if pid_file is absent, newsyslog does not kill -HUP syslog Message-ID: <199804221821.LAA29419@shasta.wstein.com>
index | next in thread | raw e-mail
>Number: 6385
>Category: docs
>Synopsis: if pid_file is absent, newsyslog does not kill -HUP syslog
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: freebsd-doc
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Apr 22 11:30:01 PDT 1998
>Last-Modified:
>Originator: Joseph Stein
>Organization:
Stein Family Internet Services
>Release: FreeBSD 2.2.6-STABLE i386
>Environment:
FreeBSD shasta.wstein.com 2.2.6-STABLE FreeBSD 2.2.6-STABLE #0: Tue Apr 14 20:37:14 PDT 1998 joes@shasta.wstein.com:/usr/src/sys/compile/SHASTA i386
>Description:
man (8) newsyslog states that newsyslog will remain compatible with
old (prior to the addition of the pid_file) syslog. This is not
the case, as syslog does not get a HUP signal without it being
explicitly mentioned in the config file.
(I've lost eight days of logs unknowningly because of this change).
From reading the source code, at about line 495, this appears to be
because of the logic that checks the flags:
else if (needroot && !(flags & CE_BINARY))
I do not like the new line that tells me the logs were turned over
because the format is not consistent with syslog, so ALL my log files
are 'BINARY' and marked with a 'B'.
>How-To-Repeat:
Remove the pidfile from the config line in /etc/newsyslog.conf and
run newsyslog. Your log files will be truncated, but not written
to again unless you manually signal syslog.
>Fix:
at line 130, keep the syslog pid regardless of the status of
needroot; (The logic for actually determining the pid in line
130 is redundant, as pid is explicitly set to 0 at line 490)
At line 495, Instead of checking
whether the logfile is binary, check to make sure we have
super-user permissions. (Please double check my test for uid==0)
--- /usr/src/usr.sbin/newsyslog/newsyslog.c Mon Apr 13 00:39:14 1998
+++ ./newsyslog.c Wed Apr 22 11:09:16 1998
@@ -127,7 +127,7 @@
errx(1, "must have root privs");
p = q = parse_file();
- syslog_pid = needroot ? get_pid(PIDFILE) : 0;
+ syslog_pid = get_pid(PIDFILE);
while (p) {
do_entry(p);
@@ -492,7 +492,7 @@
if (pid_file != NULL) {
need_notification = 1;
pid = get_pid(pid_file);
- } else if (needroot && !(flags & CE_BINARY)) {
+ } else if (needroot && !(getuid() && geteuid())) {
need_notification = 1;
pid = syslog_pid;
}
else if (needroot && !(flags & CE_BINARY))
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804221821.LAA29419>
