NetBSD Problem Report #39874

From gcw@primenet.com.au  Fri Nov  7 07:17:42 2008
Return-Path: <gcw@primenet.com.au>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id D7E3463BADB
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  7 Nov 2008 07:17:42 +0000 (UTC)
Message-Id: <20081107071738.1983.qmail@g.primenet.com.au>
Date: 7 Nov 2008 18:17:37 +1100
From: gcw@primenet.com.au
Reply-To: gcw@primenet.com.au
To: gnats-bugs@gnats.NetBSD.org
Subject: new syslogd problems
X-Send-Pr-Version: 3.95

>Number:         39874
>Category:       bin
>Synopsis:       some problems with new syslogd
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 07 07:20:01 +0000 2008
>Closed-Date:    Fri Nov 07 15:42:20 +0000 2008
>Last-Modified:  Fri Nov 07 15:45:01 +0000 2008
>Originator:     Geoff C. Wing
>Release:        NetBSD 5.99.01
>Organization:
>Environment:
System: NetBSD g.primenet.com.au 5.99.01 NetBSD 5.99.01 (G) #0: Fri Nov 7 15:35:58 EST 2008 gcw@g.primenet.com.au:/usr/netbsd/src/sys/arch/i386/compile/G i386
Architecture: i386
Machine: i386
>Description:
	1) syslogd creates rules for hostnames by stripping off any domain
	segments.  When creating information on hostnames for logging, it
	creates a FQDN.  It then
	   a) tries to find the FQDN within the stripped name
	   b) uses strcasestr

	"a" is not going to work for ~100% of syslog users.
	"b" is not a good choice but it was there before and people
	lived with it.


	2) Something bad has happened to messages from foreign hosts:

	Nov  7 16:19:20 router 1383: Nov  7 05:19:19: %SEC-6-IPACCESSLOGP:...
	Jan  1 09:59:59 Nov [7]: %LINK-3-UPDOWN: Interface FastEthernet1, ...
	Jan  1 09:59:59 Nov [7]: %LINEPROTO-5-UPDOWN: Line protocol on Int...

	The first line is from the old syslogd.  The following two are
	after rebooting and using the new syslogd (and libc).

>How-To-Repeat:
	Use it with host rules.  Look at failure.  Scratch head.
>Fix:
	Since I don't know the reasoning why certain things were chosen
	w.r.t. domain name stripping, here's the sloppy way to fix "1a".
	Maybe better would be to include a hostname without domain
	suffix in buf_msg.

Index: usr.sbin/syslogd/syslogd.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.91
diff -u -r1.91 syslogd.c
--- usr.sbin/syslogd/syslogd.c	4 Nov 2008 18:52:25 -0000	1.91
+++ usr.sbin/syslogd/syslogd.c	7 Nov 2008 06:58:25 -0000
@@ -1827,18 +1827,26 @@
 		/* do we compare with host (IMHO correct) or recvhost */
 		/* (compatible)? */
 		if (f->f_host != NULL && buffer->host != NULL) {
+			char *shorthost = strdup(buffer->host);
+
+			trim_anydomain(shorthost);
 			switch (f->f_host[0]) {
 			case '+':
-				if (! matches_spec(buffer->host, f->f_host + 1,
-				    strcasestr))
+				if (! matches_spec(shorthost, f->f_host + 1,
+				    strcasestr)) {
+					free(shorthost);
 					continue;
+				}
 				break;
 			case '-':
-				if (matches_spec(buffer->host, f->f_host + 1,
-				    strcasestr))
+				if (matches_spec(shorthost, f->f_host + 1,
+				    strcasestr)) {
+					free(shorthost);
 					continue;
+				}
 				break;
 			}
+			free(shorthost);
 		}

 		/* skip messages with the incorrect program name */

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: christos@NetBSD.org
State-Changed-When: Fri, 07 Nov 2008 10:42:20 -0500
State-Changed-Why:
fixed, thanks


From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39874 CVS commit: src/usr.sbin/syslogd
Date: Fri,  7 Nov 2008 15:42:01 +0000 (UTC)

 Module Name:	src
 Committed By:	christos
 Date:		Fri Nov  7 15:42:01 UTC 2008

 Modified Files:
 	src/usr.sbin/syslogd: syslogd.c

 Log Message:
 PR/39874: Geoff C. Wing: For compatibility trim hostname domains in bsd
 output format when matching host lines.


 To generate a diff of this commit:
 cvs rdiff -r1.92 -r1.93 src/usr.sbin/syslogd/syslogd.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.