bin/52342: syslogd does not strip domainname from local hosts

Dan Nelson dnelson at allantgroup.com
Fri May 16 14:20:11 PDT 2003


>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 at 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:


More information about the freebsd-bugs mailing list