Subject: bin/5860: syslogd doesn't properly identify messages forwarded from another host
To: None <gnats-bugs@gnats.netbsd.org>
From: None <woods@most.weird.com>
List: netbsd-bugs
Date: 07/26/1998 21:36:32
>Number:         5860
>Category:       bin
>Synopsis:       syslogd doesn't properly identify messages forwarded from another host
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 26 18:50:01 1998
>Last-Modified:
>Originator:     Greg A. Woods
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Release:        NetBSD-current 1998-07-26
>Environment:

System: NetBSD most 1.3.1 NetBSD 1.3.1 (MOST) #0: Mon May 25 01:21:22 EDT 1998 woods@most:/usr/src-1.3.1/sys/arch/sparc/compile/MOST sparc

>Description:

	Finally in FreeBSD's PR#bin/7055 there comes a fix for syslogd
	to make it properly idenify messages forwarded from a remote host.

>How-To-Repeat:

	Try setting up a log host that also fowards some messages to
	other hosts.

	Read FreeBSD's PR#bin/7055.

>Fix:

	Apply the following patch:

Index: syslogd.c
===================================================================
RCS file: /cvs/NetBSD/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 syslogd.c
*** syslogd.c	1998/07/26 20:35:06	1.1.1.2
--- syslogd.c	1998/07/27 01:32:43
***************
*** 657,664 ****
  
  	case F_FORW:
  		dprintf(" %s\n", f->f_un.f_forw.f_hname);
! 		l = snprintf(line, sizeof line, "<%d>%.15s %s", f->f_prevpri,
! 		    (char *)iov[0].iov_base, (char *)iov[4].iov_base);
  		if (l > MAXLINE)
  			l = MAXLINE;
  		if ((finet >= 0) &&
--- 657,673 ----
  
  	case F_FORW:
  		dprintf(" %s\n", f->f_un.f_forw.f_hname);
! 		/* check for local vs remote messages (from FreeBSD PR#bin/7055) */
! 		if (strcmp(f->f_prevhost, LocalHostName)) {
! 			l = snprintf(line, sizeof(line) - 1,
! 				     "<%d>%.15s Forwarded from %s: %s",
! 				     f->f_prevpri, (char *) iov[0].iov_base,
! 				     f->f_prevhost, (char *) iov[4].iov_base);
! 		} else {
! 			l = snprintf(line, sizeof(line) - 1, "<%d>%.15s %s",
! 				     f->f_prevpri, (char *) iov[0].iov_base,
! 				     (char *) iov[4].iov_base);
! 		}
  		if (l > MAXLINE)
  			l = MAXLINE;
  		if ((finet >= 0) &&

>Audit-Trail:
>Unformatted: