From owner-freebsd-bugs@FreeBSD.ORG Fri May 16 14:20:11 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8288A37B401 for ; Fri, 16 May 2003 14:20:11 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 997F443F85 for ; Fri, 16 May 2003 14:20:10 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h4GLKAUp059421 for ; Fri, 16 May 2003 14:20:10 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h4GLKAOi059420; Fri, 16 May 2003 14:20:10 -0700 (PDT) Resent-Date: Fri, 16 May 2003 14:20:10 -0700 (PDT) Resent-Message-Id: <200305162120.h4GLKAOi059420@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dan Nelson Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DAA1237B401; Fri, 16 May 2003 14:18:11 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id D45EF43FAF; Fri, 16 May 2003 14:18:10 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h4GLI8sQ098988; Fri, 16 May 2003 16:18:08 -0500 (CDT) (envelope-from dan) Message-Id: <200305162118.h4GLI8sQ098988@dan.emsphone.com> Date: Fri, 16 May 2003 16:18:08 -0500 (CDT) From: Dan Nelson To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: gshapiro@FreeBSD.org Subject: bin/52342: syslogd does not strip domainname from local hosts X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 May 2003 21:20:11 -0000 >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: