DNS glibc functions confused by trailing hyphen in host name

This is a discussion on DNS glibc functions confused by trailing hyphen in host name within the Linux Networking forums, part of the Linux Forums category; My company uses a very simple http browser implemenation written in gnu C++ to asynchronously post data to customers. We ...


Go Back   Usenet Forums > Linux Forums > Linux Networking

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-18-2008
davelasker@gmail.com
 
Posts: n/a
Default DNS glibc functions confused by trailing hyphen in host name

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

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

foo-.bar.com

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

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

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

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

Thanks for the help!
Reply With Quote
  #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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:01 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0