From nobody@FreeBSD.org  Mon Jul  2 08:00:24 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id BAEB337B405
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  2 Jul 2001 08:00:23 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.3/8.11.3) id f62F0ND66914;
	Mon, 2 Jul 2001 08:00:23 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200107021500.f62F0ND66914@freefall.freebsd.org>
Date: Mon, 2 Jul 2001 08:00:23 -0700 (PDT)
From: Andy <andy@tecc.co.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Bug in syslogd.c prevents #+hostname working
X-Send-Pr-Version: www-1.0

>Number:         28634
>Category:       bin
>Synopsis:       Bug in syslogd.c prevents #+hostname working
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 02 08:10:02 PDT 2001
>Closed-Date:    Tue Nov 27 05:50:20 PST 2001
>Last-Modified:  Tue Nov 27 05:50:47 PST 2001
>Originator:     Andy
>Release:        4.x-STABLE
>Organization:
>Environment:
FreeBSD planet.tecc.co.uk 4.3-STABLE FreeBSD 4.3-STABLE #0: Fri Jun 22 16:06:42 BST 2001     andy@planet.tecc.co.uk:/usr/src/sys/compile/PLANET  i386
>Description:
When using the "log from hostname" function in syslog.conf like:-

#+hostname
local7.=info  <tab> <tab>  /var/log/file
#+*

fails to log to file correctly, in fact, logs nothing.

>How-To-Repeat:
Try it, it's very simple to recreate as above.
>Fix:
Simple one line patch to :
File: [freebsd] / src / usr.sbin / syslogd / syslogd.c (download)
Revision 1.78, Mon May 21 22:13:55 2001 UTC (5 weeks, 6 days ago) by dwmalone 


1414d1413
<                       p++;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dwmalone 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Mon Jul 2 08:16:42 PDT 2001 
Responsible-Changed-Why:  
I'll have a look at this as I imported the hostname stuff. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=28634 

From: Ceri <ceri@techsupport.co.uk>
To: Andy <andy@tecc.co.uk>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/28634: Bug in syslogd.c prevents #+hostname working
Date: Mon, 2 Jul 2001 16:22:14 +0100

 On Mon, Jul 02, 2001 at 08:00:23AM -0700, Andy said:
 > 
 > When using the "log from hostname" function in syslog.conf like:-
 > 
 > #+hostname
 > local7.=info  <tab> <tab>  /var/log/file
 > #+*
 > 
 > fails to log to file correctly, in fact, logs nothing.
 
 I've been having the exact same problem :
 
 *.*                                             /var/log/all.log
 +212.250.77.217
 *.*                                             /var/log/netpilot
 
 logs all messages from 212.250.77.217 to /var/log/all.log instead of
 /var/log/netpilot.
 
 Ceri
 
 -- 
 Your local RFC Nazi

From: "Andy" <andy@tecc.co.uk>
To: <freebsd-gnats-submit@FreeBSD.org>, "Andy" <andy@tecc.co.uk>
Cc:  
Subject: Re: bin/28634: Bug in syslogd.c prevents #+hostname working
Date: Mon, 2 Jul 2001 16:41:55 +0100

 It's simple to see what's going on without
 using another host to syslog from/to. Just
 create a syslog.conf file with the requited
 spec. Then when running syslogd use -d option
 and see the line cfline where it gets parsed.
 You'll see it includes the leading "+" char.
 My patch just skipped by one char to drop it.
 
 I compiled and ran this and it worked straight
 off.
 
 Regards
 Andy
 
State-Changed-From-To: open->analyzed 
State-Changed-By: dwmalone 
State-Changed-When: Mon Jul 2 11:22:32 PDT 2001 
State-Changed-Why:  
I think the problem here is that giving the full hostname doesn't work 
if the remote machine is in the same domain as the machine running syslogd. 
I'll try to fix this and improve the explaination in the man page. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=28634 

From: Ruslan Ermilov <ru@FreeBSD.org>
To: Andy <andy@tecc.co.uk>, David Malone <dwmalone@FreeBSD.org>
Cc: bug-followup@FreeBSD.org, bugs@FreeBSD.org
Subject: Re: bin/28634: Bug in syslogd.c prevents #+hostname working
Date: Tue, 3 Jul 2001 11:42:24 +0300

 On Mon, Jul 02, 2001 at 08:00:23AM -0700, Andy wrote:
 > 
 > When using the "log from hostname" function in syslog.conf like:-
 > 
 > #+hostname
 > local7.=info  <tab> <tab>  /var/log/file
 > #+*
 > 
 > fails to log to file correctly, in fact, logs nothing.
 > 
 Works nice here without your patch, modulo the bug David mentioned.
 If the sending host is within the same domain, using FQDN for the
 sending host does not work, unless the following patch is applied.
 
 I must admit I don't like how the ``#+'' is currently implemented.
 For example, it is unclear (and undocumented) from the reading
 of the manpage, that the -n flag affects the hostname specification
 in syslog.conf(5).
 
 
 Index: syslogd.c
 ===================================================================
 RCS file: /home/ncvs/src/usr.sbin/syslogd/syslogd.c,v
 retrieving revision 1.78
 diff -u -p -r1.78 syslogd.c
 --- syslogd.c	2001/05/21 22:13:55	1.78
 +++ syslogd.c	2001/07/03 08:33:54
 @@ -1524,8 +1524,12 @@ cfline(line, f, prog, host)
  	/* save hostname if any */
  	if (host && *host == '*')
  		host = NULL;
 -	if (host)
 +	if (host) {
 +		if ((p = strchr(host, '.')) &&
 +		    strcasecmp(p + 1, LocalDomain) == 0)
 +			*p = '\0';
  		f->f_host = strdup(host);
 +	}
  
  	/* save program name if any */
  	if (prog && *prog == '*')
 
 
 Cheers,
 -- 
 Ruslan Ermilov		Oracle Developer/DBA,
 ru@sunbay.com		Sunbay Software AG,
 ru@FreeBSD.org		FreeBSD committer,
 +380.652.512.251	Simferopol, Ukraine
 
 http://www.FreeBSD.org	The Power To Serve
 http://www.oracle.com	Enabling The Information Age

From: David Malone <dwmalone@maths.tcd.ie>
To: Ruslan Ermilov <ru@FreeBSD.org>
Cc: Andy <andy@tecc.co.uk>, David Malone <dwmalone@FreeBSD.org>,
	bug-followup@FreeBSD.org, bugs@FreeBSD.org
Subject: Re: bin/28634: Bug in syslogd.c prevents #+hostname working 
Date: Tue, 03 Jul 2001 09:47:14 +0100

 > Works nice here without your patch, modulo the bug David mentioned.
 > If the sending host is within the same domain, using FQDN for the
 > sending host does not work, unless the following patch is applied.
 
 > I must admit I don't like how the ``#+'' is currently implemented.
 > For example, it is unclear (and undocumented) from the reading
 > of the manpage, that the -n flag affects the hostname specification
 > in syslog.conf(5).
 
 Yep - I think this could all be documented better in the man page.
 I think the "-n" flag and the host selection stuff were added about
 the same time and the man page was never updated to take account
 of the interaction.
 
 The patch you included would be a reasonable fix, but I think it
 may be better to keep the full host name within syslogd until the
 log message is written to the log. This is because syslogd trys to
 reconstruct the full host name in atleasy one place after it has
 truncated it, which seems silly.
 
 	David.
State-Changed-From-To: analyzed->feedback 
State-Changed-By: des 
State-Changed-When: Wed Sep 12 22:11:14 PDT 2001 
State-Changed-Why:  
Fixed in -CURRENT (unless there are other bugs which were masked by this one) 


Responsible-Changed-From-To: dwmalone->des 
Responsible-Changed-By: des 
Responsible-Changed-When: Wed Sep 12 22:11:14 PDT 2001 
Responsible-Changed-Why:  
I'll handle the shakedown and MFC. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=28634 
State-Changed-From-To: feedback->closed 
State-Changed-By: des 
State-Changed-When: Tue Nov 27 05:50:20 PST 2001 
State-Changed-Why:  
This was actually MFCed siz weeks ago, but I forgot to close the PR. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=28634 
>Unformatted:
