Underscores again

Joseph S D Yao jsdy at cospo.osis.gov
Thu Apr 20 17:18:58 UTC 2000


The RFCs do say that underscore is illegal in host names, but caution
that DNS labels should not be so restricted.

Let's see what BIND says.

In db_load.c, a call to ns_nameok() depends on the context.  Part of
the context is the record type.  Part of the context is the "transport"
- is this part of a primary/hint zone?  Is it part of a secondary/stub
zone?  Is it something else, presumed to be a response from elsewhere?
[Astute readers will glean that this is how "check-names" distinguishes
one from the other.]

In ns_init.c, the context is gleaned from the type and transport by
ns_ownercontext():

	A, WKS, MX:	primary/secondary/update => "owner"
			response => "hostname"
			anything else => error
	MB, MG:		"mailname"
	anything else:	"domain"

In ns_init.c, again, ns_nameok() checks names differentially thus:

	severity == ignore => name is OK, period.  ;-)
	context "domain" => if class is IN, then it must pass res_dnok()
	context "owner" => if class is IN, then it must pass res_ownok()
	context "mailname" => it must pass res_mailok()
	context "hostname" => it must pass res_hnok()
	then it does other stuff, including issuing warnings,
	and changes a "bad" to "good" if severity == warn.

Now we have to skip over to ../../lib/resolv/res_comp.c.

A hostname check verifies that each dot-separated component starts and
ends with an alphanumeric, and hyphens are allowed internally.  "." and
"" are allowed.

An "owner" may be "*", or "*.hostname".

A "mailname" may be "" or any characters between Space and Delete
[including an escaped period, "\."], followed by ".hostname".

A "domain" contains any characters between Space and Delete.  "This
function is quite liberal, since RFC 1034's character sets are only
recommendations."

YMMV.

-- 
Joe Yao				jsdy at cospo.osis.gov - Joseph S. D. Yao
COSPO/OSIS Computer Support					EMT-B
-----------------------------------------------------------------------
This message is not an official statement of COSPO policies.



More information about the bind-users mailing list