Networking Forums

Networking Forums > Computer Networking > Linux Networking > DNS glibc functions confused by trailing hyphen in host name

Reply
Thread Tools Display Modes

DNS glibc functions confused by trailing hyphen in host name

 
 
davelasker@gmail.com
Guest
Posts: n/a

 
      05-18-2008, 07:24 PM
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
 
 
 
 
Ashish Shukla आशीष शुक्ल
Guest
Posts: n/a

 
      05-23-2008, 08:22 PM
-----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
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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS glibc functions confused by trailing slash in host name davelasker@gmail.com Linux Networking 7 05-21-2008 07:53 PM
glibc, glibc sockets begin.middle.end@gmail.com Linux Networking 2 03-13-2008 03:23 AM
help on synchronizing functions in kernel 2.6 Giacomo Linux Networking 0 06-06-2005 08:10 PM
glibc: socket and fdopen Thomas Jollans Linux Networking 8 09-05-2004 12:21 AM
Howcomes we are trailing so far behind? Dan Broadband 9 04-24-2004 08:46 PM



1 2 3 4 5 6 7 8 9 10 11