This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/4671] gethostbyname() cant resolve names starting/ending with "-"


http://sourceware.org/bugzilla/show_bug.cgi?id=4671

Alex Merry <bugs at randomguy3 dot me.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugs at randomguy3 dot
                   |                            |me.uk

--- Comment #7 from Alex Merry <bugs at randomguy3 dot me.uk> 2011-01-07 18:49:07 UTC ---
(In reply to comment #6)
> "The DNS itself places only one restriction on the particular labels that can
> be used to identify resource 
> records.  That one restriction relates to the length of the label and the full
> name. [...] Those restrictions 
> aside, any binary string whatever can be used as the label of any resource
> record."
>   -- RFC 2181, section 11
> 
> RFC3696, section 2 verifies this: "Any characters, or combination of bits (as
> octets), are permitted in 
> DNS names." Then it describes how the old ARPANET rules worked. But we moved
> beyond those 
> rules a long time ago. Just look at the international domain names.

Actually, while RFC 2181 states that there are no restrictions on DNS labels,
it does not say anything about host names (not all records that can be stored
in DNS are host names).  In fact, it explicitly says that

"Note however, that the various applications that make use of DNS data can have
restrictions imposed on what particular values are acceptable in their
environment."

RFC 1123 still constitutes the accepted standard for valid host names, and this
is what glibc's gethostbyname() implements.  Actually, glibc implements a
relaxation of RFC1123 that allows underscores anywhere RFC1123 permits hyphens,
presumably to deal with errant Windows machines that like to put underscores in
their names.

RFC 3696 is quite woolly on the subject of host names.  It describes RFC 1123's
restrictions on host names as "a preferred form that is required by most
applications".

Also, international domain names are a different matter entirely, as they
essentially work (as I understand it) by converting invalid host names to RFC
1123-compatible host names.

Arguing by RFC is clearly not going to get us anywhere, given the above.  The
best argument for this change is that there are domains that require
gethostbyname() to accept hyphens (and, presumably, underscores) at the start
and end of domain segments in order to be resolved.  Glibc already relaxes RFC
1123's restrictions to allow underscores, so why not allow hyphens in any
position as well?

The argument about mistaking domain names starting with hyphens for options is
spurious, by the way.  Given that these domains exist, it's perfectly
reasonable that they might be passed to a tool regardless of whether or not
gethostbyname() accepts them, and the tool will do option parsing before
calling gethostbyname().

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]