bin/124938: comments at the end of the line of the syslog.conf

Andriy Pylypenko bambyster at gmail.com
Tue Jun 24 14:20:03 UTC 2008


>Number:         124938
>Category:       bin
>Synopsis:       comments at the end of the line of the syslog.conf
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 24 14:20:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Andriy Pylypenko
>Release:        FreeBSD 6.3-STABLE i386
>Organization:
Sippysoft Inc
>Environment:
FreeBSD sempron.sippysoft.com 6.3-STABLE FreeBSD 6.3-STABLE #1: Fri Feb 15 08:42:55 EET 2008 root at sempron.sippysoft.com:/usr/obj/usr/src/sys/BAMBY i386
>Description:
Comments in the syslog.conf are supported almost anywhere except the end of the line of the selector specification. So the following line:

   cron.*         /var/log/cron    # cron messages

means that the output file name is "/var/log/cron    # cron messages" and not "/var/log/cron".
>How-To-Repeat:

>Fix:
The following patch makes the syslogd to recognize and throw away comments at the end of the line of a the selector spec before stripping trailing whitespaces.
I hope the compatibility with the old version of syslogd is not an issue as it is highly unlikely that some people use a file or a host names with embedded '#'.

Patch attached with submission follows:

--- src/usr.sbin/syslogd/syslogd.c.orig	Tue Jun 24 16:24:10 2008
+++ src/usr.sbin/syslogd/syslogd.c	Tue Jun 24 16:34:54 2008
@@ -1635,6 +1635,8 @@
 			prog[i] = 0;
 			continue;
 		}
+		if ((p = strchr(cline, '#')) != NULL)
+			*p = '\0';
 		for (i = strlen(cline) - 1; i >= 0 && isspace(cline[i]); i--)
 			cline[i] = '\0';
 		f = (struct filed *)calloc(1, sizeof(*f));


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list