View Single Post

  #2 (permalink)  
Old 05-23-2008
Ashish Shukla आशीष शुक्ल
 
Posts: n/a
Default Re: DNS glibc functions confused by trailing hyphen in host name

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> davelasker writes:


davelasker> My company uses a very simple http browser implemenation written in
davelasker> gnu C++ to asynchronously post data to customers. We use
davelasker> gethostbyname_r to convert FQDN to IP address, then set up a socket,
davelasker> set the headers, send the data, etc.

davelasker> One of our customers has a host name with a trailing hypen,i.e their
davelasker> FQDN is like

davelasker> foo-.bar.com

davelasker> The various glibc library DNS lookup functions fail when looking up
davelasker> this FQDN. I tried gethostbyname_r and getaddrinfo. gethostbyname_r
davelasker> returns NO_RECOVERY. getaddrinfo returns EAI_NONAME. I've tried this
davelasker> on RH 6.2, and on RHEL 3 and 4.

davelasker> nslookup, host, and dig all find this name with no problem.

davelasker> AFAIKT from looking at IETF specs, the trailing hyphen is illegal.
davelasker> But
davelasker> I don't want to have to tell my customer to change his hostname.

davelasker> What are the nslookup, host, and dig commands doing differently to
davelasker> lookup the name than what is done in the glibc
davelasker> functions?

They're doing DNS queries without using glibc get...() routines. To fix
this issue at your end, you've to patch /lib{64,}/libnss_dns.so* which
is provided by glibc.

davelasker> Thanks for the help!

HTH
- --
Ashish Shukla आशीष शुक्ल http://wahjava.wordpress.com/
·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkg3J4UACgkQHy+EEHYuXnRtAgCfVoFMpvZeZC OcgNk2JyD7wHKY
zsgAoOw/t7eAk7h9pHscOzRCMvCdo2da
=+FPX
-----END PGP SIGNATURE-----
Reply With Quote