NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/50367: libc resolver library does not resolve host names with underscores ("_")



>Number:         50367
>Category:       lib
>Synopsis:       libc resolver library does not resolve host names with underscores ("_")
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 25 02:25:00 +0000 2015
>Originator:     Stefan Schaeckeler
>Release:        NetBSD 7.0
>Organization:
>Environment:
NetBSD t60p 7.0 NetBSD 7.0 (GENERIC) #0: Sat Sep 26 20:21:41 PDT 2015  root@t60p:/usr/obj/sys/arch/i386/compile/GENERIC i386
>Description:
Several internet radio stations use host names with underscores, e.g.

http://dradio_mp3_dlf_m.akacast.akamaistream.net/7/249/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dlf_m
http://dradio_mp3_dkultur_m.akacast.akamaistream.net/7/530/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dkultur_m
http://dradio_mp3_dwissen_m.akacast.akamaistream.net/7/728/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dwissen_m


Such host names are not resolved:

$ mpg123 -yC http://dradio_mp3_dlf_m.akacast.akamaistream.net/7/249/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dlf_m
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
        version 1.21.0; written and copyright by Michael Hipp and others
        free software (LGPL) without any warranty but with best wishes

[resolver.c:289] error: Resolving dradio_mp3_dlf_m.akacast.akamaistream.net:80: Non-recoverable failure in name resolution

[httpget.c:592] error: Unable to establish connection to dradio_mp3_dlf_m.akacast.akamaistream.net

[mpg123.c:611] error: Access to http resource http://dradio_mp3_dlf_m.akacast.akamaistream.net/7/249/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dlf_m failed.



Other libcs such as Linux' and FreeBSD's libc resolve such host names. Apparently, NetBSD's resolver library filters out underscores. Provided patch fixes the too restrictive filtering.
>How-To-Repeat:
mpg123 -yC http://dradio_mp3_dlf_m.akacast.akamaistream.net/7/249/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dlf_m

or

$ getaddrinfo  dradio_mp3_dlf_m.akacast.akamaistream.net         
getaddrinfo: Non-recoverable failure in name resolution

>Fix:
--- lib/libc/resolv/res_comp.c  2015-10-24 19:05:43.000000000 -0700
+++ lib/libc/resolv/res_comp.c.new      2015-10-24 18:13:24.000000000 -0700
@@ -163,6 +163,7 @@
  */
 #define PERIOD 0x2e
 #define hyphenchar(c) ((c) == 0x2d)
+#define underschar(c) ((c) == 0x5f)
 #define bslashchar(c) ((c) == 0x5c)
 #define periodchar(c) ((c) == PERIOD)
 #define asterchar(c) ((c) == 0x2a)
@@ -171,7 +172,7 @@
 #define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
 
 #define borderchar(c) (alphachar(c) || digitchar(c))
-#define middlechar(c) (borderchar(c) || hyphenchar(c))
+#define middlechar(c) (borderchar(c) || hyphenchar(c) || underschar(c))
 #define        domainchar(c) ((c) > 0x20 && (c) < 0x7f)
 
 int



Home | Main Index | Thread Index | Old Index