Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 May 2003 16:18:08 -0500 (CDT)
From:      Dan Nelson <dnelson@allantgroup.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        gshapiro@FreeBSD.org
Subject:   bin/52342: syslogd does not strip domainname from local hosts
Message-ID:  <200305162118.h4GLI8sQ098988@dan.emsphone.com>
Resent-Message-ID: <200305162120.h4GLKAOi059420@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         52342
>Category:       bin
>Synopsis:       syslogd does not strip domainname from local hosts
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 16 14:20:10 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Dan Nelson
>Release:        FreeBSD 5.1-BETA i386
>Organization:
The Allant Group
>Environment:
System: FreeBSD dan.emsphone.com 5.1-BETA FreeBSD 5.1-BETA #269: Tue May 13 09:30:33 CDT 2003 zsh@dan.emsphone.com:/usr/src/sys/i386/compile/DANSMP i386


	
>Description:
	

After the commit to syslogd.c on 2003/05/04, domain removal for
machines in the same domain as the syslod server doesn't seem to work. 
This makes hostname entries in syslogd.config that have the short name
instead of FQDN fail to match.

>How-To-Repeat:
	
>Fix:

Seems to be a simple off-by-one error. Consider the case where:

  hname = "myhost.mydomain.com"
  hl = 19
  LocalDomain = "mydomain.com"
  LocalDomainLen = 12

hname[hl-LocalDomainLen] points to the 'm' in mydomain, not the dot.
(hname + hl - LocalDomainLen + 1) points to "ydomain.com".

	

Index: syslogd.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.114
diff -u -r1.114 syslogd.c
--- syslogd.c	4 May 2003 22:05:40 -0000	1.114
+++ syslogd.c	16 May 2003 21:07:53 -0000
@@ -1308,9 +1308,9 @@
 	hl = strlen(hname);
 	if (hl > 0 && hname[hl-1] == '.')
 		hname[--hl] = '\0';
-	if (hl > LocalDomainLen && hname[hl-LocalDomainLen] == '.' &&
-	    strcasecmp(hname + hl - LocalDomainLen + 1, LocalDomain) == 0)
-		hname[hl-LocalDomainLen] = '\0';
+	if (hl > LocalDomainLen && hname[hl - LocalDomainLen - 1] == '.' &&
+	    strcasecmp(hname + hl - LocalDomainLen, LocalDomain) == 0)
+		hname[hl - LocalDomainLen - 1] = '\0';
 	return (hname);
 }
 

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305162118.h4GLI8sQ098988>