public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/4671] New: gethostbyname() cant resolve names starting/ending with "-"
@ 2007-06-20 17:19 nikolaeff at gmail dot com
  2007-07-02 16:40 ` [Bug libc/4671] " jakub at redhat dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: nikolaeff at gmail dot com @ 2007-06-20 17:19 UTC (permalink / raw)
  To: glibc-bugs

gethostbyname() fails to resolve domain names with minus sign at beginning or end of domain name,
in example -kol.deviantart.com, while it can be resolved using host and nslookup.

example sessiong:

insa@devel:~$ ping -- -kol.deviantart.com
ping: unknown host -kol.deviantart.com

insa@devel:~$ host -- -kol.deviantart.com
-kol.deviantart.com has address 69.28.181.43

Breif look at linux iputils/ping.c shows that it's using gethostbyname() function.
So i wrote C test example that can be found at http://insa.pp.ru/files/bugs/gethost.c

Tested on Debian 3.1, Debian 4, FreeBSD 5.4. All i386.
Mac OS X not affected.

-- 
           Summary: gethostbyname() cant resolve names starting/ending with
                    "-"
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: nikolaeff at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/4671] gethostbyname() cant resolve names starting/ending with "-"
  2007-06-20 17:19 [Bug libc/4671] New: gethostbyname() cant resolve names starting/ending with "-" nikolaeff at gmail dot com
@ 2007-07-02 16:40 ` jakub at redhat dot com
  2007-07-02 20:23 ` nikolaeff at gmail dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: jakub at redhat dot com @ 2007-07-02 16:40 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2007-07-02 16:40 -------
Such hostnames are invalid, see section 2 of RFC3696.
For hostnames, hyphen can be only in the middle, not at the start of at the end.


-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/4671] gethostbyname() cant resolve names starting/ending with "-"
  2007-06-20 17:19 [Bug libc/4671] New: gethostbyname() cant resolve names starting/ending with "-" nikolaeff at gmail dot com
  2007-07-02 16:40 ` [Bug libc/4671] " jakub at redhat dot com
@ 2007-07-02 20:23 ` nikolaeff at gmail dot com
  2007-09-23 22:33 ` drepper at redhat dot com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: nikolaeff at gmail dot com @ 2007-07-02 20:23 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From nikolaeff at gmail dot com  2007-07-02 20:23 -------
(In reply to comment #1)
> Such hostnames are invalid, see section 2 of RFC3696.
> For hostnames, hyphen can be only in the middle, not at the start of at the end.
> 

Well, it's true, but
1) hostnames starting with numeric value are also not valid, but can be resolved via gethostbyname() 
(i.e. ping 12345.livejournal.com);

2) We getting odd behaviour on various system. Even worse - on same machine using different tools 
(nslookup vs. ping).

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/4671] gethostbyname() cant resolve names starting/ending with "-"
  2007-06-20 17:19 [Bug libc/4671] New: gethostbyname() cant resolve names starting/ending with "-" nikolaeff at gmail dot com
  2007-07-02 16:40 ` [Bug libc/4671] " jakub at redhat dot com
  2007-07-02 20:23 ` nikolaeff at gmail dot com
@ 2007-09-23 22:33 ` drepper at redhat dot com
  2008-10-12 20:52 ` gredhat dot nospam dot bug at freestart dot hu
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: drepper at redhat dot com @ 2007-09-23 22:33 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2007-09-23 22:32 -------
I looked at this and saw that not even the latest bind version allows - at the
beginning.  If anybody allows it this is likely a side effect of not using the
bind code base.  I see no reason to diverge here.

Plus, this could have unwanted effects.  If somebody makes a mistake when
specifying a host name a parameter might be mistaken for it.  This might even be
exploitable.

So, no, this won't change.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/4671] gethostbyname() cant resolve names starting/ending with "-"
  2007-06-20 17:19 [Bug libc/4671] New: gethostbyname() cant resolve names starting/ending with "-" nikolaeff at gmail dot com
                   ` (2 preceding siblings ...)
  2007-09-23 22:33 ` drepper at redhat dot com
@ 2008-10-12 20:52 ` gredhat dot nospam dot bug at freestart dot hu
  2009-03-07 13:39 ` alexeyten+deb at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: gredhat dot nospam dot bug at freestart dot hu @ 2008-10-12 20:52 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From gredhat dot nospam dot bug at freestart dot hu  2008-10-12 20:51 -------
If gethostbyname refuses the invalid name in the below request, why does it
query the DNS (as can be seen with e.g. tcpdump)?

links http://szini-.tvn.hu/Koszonjuk.mp3

-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/4671] gethostbyname() cant resolve names starting/ending with "-"
  2007-06-20 17:19 [Bug libc/4671] New: gethostbyname() cant resolve names starting/ending with "-" nikolaeff at gmail dot com
                   ` (3 preceding siblings ...)
  2008-10-12 20:52 ` gredhat dot nospam dot bug at freestart dot hu
@ 2009-03-07 13:39 ` alexeyten+deb at gmail dot com
  2010-01-20  9:02 ` bjorn at haxx dot se
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: alexeyten+deb at gmail dot com @ 2009-03-07 13:39 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From alexeyten+deb at gmail dot com  2009-03-07 13:38 -------
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/144431



This bug report is valid. The RFC does not prohibit labels that don't start with
a letter; it merely recommends against them. The definition of "label" mentioned
above is part of a guideline introduced with this text:

"The following syntax will result in fewer problems with many
applications that use domain names (e.g., mail, TELNET)."

Points in favor of supporting domain names that don't necessarily follow those
guidelines:

1. There are actual domains out on the Internet running web sites with such
domain names (several blogs at blogspot.com spring to mind)
2. Such domains resolve on other OSes (not just Windows, but also OS X).
3. Direct DNS queries (dig, host, nslookup) on Linux work fine with such names.
4. Even gethostbyname() on Linux works for such names when they're in the local
/etc/hosts file. Possibly in NIS maps as well.

Point 4 is especially telling; I don't see any reason for gethostbyname() to
introduce a restriction between two interfaces when that both operate correctly
without the restriction. Especially not a restriction that prevents access to
actual web sites. Telling users that "The owner of that site shouldn't have
named it that" is not helpful.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/4671] gethostbyname() cant resolve names starting/ending with "-"
  2007-06-20 17:19 [Bug libc/4671] New: gethostbyname() cant resolve names starting/ending with "-" nikolaeff at gmail dot com
                   ` (4 preceding siblings ...)
  2009-03-07 13:39 ` alexeyten+deb at gmail dot com
@ 2010-01-20  9:02 ` bjorn at haxx dot se
  2010-08-20  8:12 ` allan at archlinux dot org
  2010-09-17  0:17 ` tyler dot szabo at gmail dot com
  7 siblings, 0 replies; 10+ messages in thread
From: bjorn at haxx dot se @ 2010-01-20  9:02 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From bjorn at haxx dot se  2010-01-20 09:01 -------
"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.


-- 


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/4671] gethostbyname() cant resolve names starting/ending with "-"
  2007-06-20 17:19 [Bug libc/4671] New: gethostbyname() cant resolve names starting/ending with "-" nikolaeff at gmail dot com
                   ` (5 preceding siblings ...)
  2010-01-20  9:02 ` bjorn at haxx dot se
@ 2010-08-20  8:12 ` allan at archlinux dot org
  2010-09-17  0:17 ` tyler dot szabo at gmail dot com
  7 siblings, 0 replies; 10+ messages in thread
From: allan at archlinux dot org @ 2010-08-20  8:12 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |allan at archlinux dot org


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/4671] gethostbyname() cant resolve names starting/ending with "-"
  2007-06-20 17:19 [Bug libc/4671] New: gethostbyname() cant resolve names starting/ending with "-" nikolaeff at gmail dot com
                   ` (6 preceding siblings ...)
  2010-08-20  8:12 ` allan at archlinux dot org
@ 2010-09-17  0:17 ` tyler dot szabo at gmail dot com
  7 siblings, 0 replies; 10+ messages in thread
From: tyler dot szabo at gmail dot com @ 2010-09-17  0:17 UTC (permalink / raw)
  To: glibc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tyler dot szabo at gmail dot
                   |                            |com


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug libc/4671] gethostbyname() cant resolve names starting/ending with "-"
       [not found] <bug-4671-131@http.sourceware.org/bugzilla/>
@ 2011-01-07 18:49 ` bugs at randomguy3 dot me.uk
  0 siblings, 0 replies; 10+ messages in thread
From: bugs at randomguy3 dot me.uk @ 2011-01-07 18:49 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-01-07 18:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-20 17:19 [Bug libc/4671] New: gethostbyname() cant resolve names starting/ending with "-" nikolaeff at gmail dot com
2007-07-02 16:40 ` [Bug libc/4671] " jakub at redhat dot com
2007-07-02 20:23 ` nikolaeff at gmail dot com
2007-09-23 22:33 ` drepper at redhat dot com
2008-10-12 20:52 ` gredhat dot nospam dot bug at freestart dot hu
2009-03-07 13:39 ` alexeyten+deb at gmail dot com
2010-01-20  9:02 ` bjorn at haxx dot se
2010-08-20  8:12 ` allan at archlinux dot org
2010-09-17  0:17 ` tyler dot szabo at gmail dot com
     [not found] <bug-4671-131@http.sourceware.org/bugzilla/>
2011-01-07 18:49 ` bugs at randomguy3 dot me.uk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).