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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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! |
|
|||
|
-----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----- |