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. Fix: See attached patch Patch attached with submission follows: How-To-Repeat: Try resolving a name containing a leading '_', such as 'gc._msdcs.example.org'
A simpler test case: #include <netinet/in.h> #include <resolv.h> int main (int argc, char *argv[]) { if (argc < 2) return 1; int ret = res_hnok(argv[1]); printf("%d\n", ret); } Usage: landonf:~> ./test-res_hnok gc._msdcs.example.org 0 landonf:~> ./test-res_hnok gc.msdcs.example.org 1
Assign to committer of the original feature.
A commit references this bug: Author: ume Date: Wed Jun 10 16:15:23 UTC 2015 New revision: 284229 URL: https://svnweb.freebsd.org/changeset/base/284229 Log: Add support for '_' occurring at the beginning or end of a name component. PR: 176093 Submitted by: landonf__at__bikemonkey.org MFC after: 1 week Changes: head/lib/libc/resolv/res_comp.c
Thank you. Committed.
A commit references this bug: Author: ume Date: Thu Jun 18 16:39:06 UTC 2015 New revision: 284559 URL: https://svnweb.freebsd.org/changeset/base/284559 Log: MFC r284229: Add support for '_' occurring at the beginning or end of a name component. PR: 176093 Submitted by: landonf__at__bikemonkey.org Changes: _U stable/10/ stable/10/lib/libc/resolv/res_comp.c
A commit references this bug: Author: ume Date: Thu Jun 18 16:43:38 UTC 2015 New revision: 284560 URL: https://svnweb.freebsd.org/changeset/base/284560 Log: MFC r284229: Add support for '_' occurring at the beginning or end of a name component. PR: 176093 Submitted by: landonf__at__bikemonkey.org Changes: _U stable/9/lib/libc/ stable/9/lib/libc/resolv/res_comp.c
A commit references this bug: Author: ume Date: Thu Jun 18 16:46:41 UTC 2015 New revision: 284561 URL: https://svnweb.freebsd.org/changeset/base/284561 Log: MFC r284229: Add support for '_' occurring at the beginning or end of a name component. PR: 176093 Submitted by: landonf__at__bikemonkey.org Changes: _U stable/8/lib/libc/ stable/8/lib/libc/resolv/res_comp.c