Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Feb 2013 03:45:41 GMT
From:      Landon Fuller <landonf@bikemonkey.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/176093: [patch] Fix resolver support for '_' character in hostnames
Message-ID:  <201302130345.r1D3jfX4064763@red.freebsd.org>
Resent-Message-ID: <201302130350.r1D3o46U049134@freefall.freebsd.org>

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

>Number:         176093
>Category:       misc
>Synopsis:       [patch] Fix resolver support for '_' character in hostnames
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 13 03:50:01 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Landon Fuller
>Release:        9.1-RELEASE
>Organization:
>Environment:
FreeBSD directory2 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r243826: Tue Dec  4 06:55:39 UTC 2012     root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
Back in 2008, the libc resolver was modified to accept Microsoft's non-standard use of '_' in host names:

http://svnweb.freebsd.org/base?view=revision&revision=176325

The fix appears to be incomplete, as it only covered the case where an underscore occurs within a domain component (eg, 'example_name', rather than at the beginning or end.

The attached patch adds support for '_' occurring at the beginning, middle, or end of a name component. This style of name is required by AD, and by extension, by Samba4; this patch fixes issues with samba4 replication on FreeBSD.

>How-To-Repeat:
Try resolving a name containing a leading '_', such as 'gc._msdcs.example.org'

>Fix:
See attached patch

Patch attached with submission follows:

--- lib/libc/resolv/res_comp.c.orig	2013-02-12 21:50:31.000000000 -0500
+++ lib/libc/resolv/res_comp.c	2013-02-12 21:51:05.000000000 -0500
@@ -147,12 +147,12 @@
 		   || ((c) >= 0x61 && (c) <= 0x7a))
 #define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
 
-#define borderchar(c) (alphachar(c) || digitchar(c))
 #ifdef	RES_ENFORCE_RFC1034
-#define middlechar(c) (borderchar(c) || hyphenchar(c))
+#define borderchar(c) (alphachar(c) || digitchar(c))
 #else
-#define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
+#define borderchar(c) (alphachar(c) || digitchar(c) || underscorechar(c))
 #endif
+#define middlechar(c) (borderchar(c) || hyphenchar(c))
 #define	domainchar(c) ((c) > 0x20 && (c) < 0x7f)
 
 int


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



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