misc/68691: syslogd - correct program name handling

Markus Oestreicher m.oe at x-trader.de
Mon Jul 5 06:20:38 PDT 2004


>Number:         68691
>Category:       misc
>Synopsis:       syslogd - correct program name handling
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 05 13:20:22 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Markus Oestreicher
>Release:        4.10-STABLE #0: Mon Jul  5 10:02:52 GMT 2004
>Organization:
>Environment:
FreeBSD qhmail2.colt1.inetserver.de 4.10-STABLE FreeBSD 4.10-STABLE #0: Mon Jul  5 10:02:52 GMT 2004     root at qhmail2.colt1.inetserver.de:/usr
>Description:
A filter for a specific program name was not working. 

Looking at the source I found that the parsing routine does not stop when a white-space is found.

So the whole line would be treated as program name which is wrong.
>How-To-Repeat:
The following syntax in syslog.conf didn't work:

!PROGRAM
*.*   /path/to/file

where as the corresponding log file looks like:

Jul  5 15:03:29 hostname PROGRAM some logging text


>Fix:
Adding a check for a white-space to the list of abort criterias worked for me:

*** syslogd.c.sik       Mon Jul  5 14:53:09 2004
--- syslogd.c   Mon Jul  5 14:54:18 2004
***************
*** 870,876 ****
        /* extract program name */
        for (i = 0; i < NAME_MAX; i++) {
                if (!isprint(msg[i]) || msg[i] == ':' || msg[i] == '[' ||
!                   msg[i] == '/')
                        break;
                prog[i] = msg[i];
        }
--- 870,876 ----
        /* extract program name */
        for (i = 0; i < NAME_MAX; i++) {
                if (!isprint(msg[i]) || msg[i] == ':' || msg[i] == '[' ||
!                   msg[i] == '/' || msg[i] == ' ')
                        break;
                prog[i] = msg[i];
        }

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


More information about the freebsd-bugs mailing list