Bug 105374

Summary: getaddrinfo returns non-canonical node name
Product: [Retired] Red Hat Linux Beta Reporter: David Woodhouse <dwmw2>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED UPSTREAM QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: beta1CC: drepper, fweimer
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-09-28 07:09:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
test program none

Description David Woodhouse 2003-09-25 15:02:49 UTC
See attached test program.

When invoked with IP addresses for which there is no reverse DNS, it should
surely fail? When invoked with a non-canonical IPv6 address, it should certainly
not just return the same text?

./asd 2002:c1ed:8229::1
getaddrinfo() succeeded, result 2002:c1ed:8229::1
./asd 2002:c1ed:8229:0::1
getaddrinfo() succeeded, result 2002:c1ed:8229:0::1

Either both the above should fail, or at least they should both return the
former result.

Comment 1 David Woodhouse 2003-09-25 15:04:22 UTC
Created attachment 94718 [details]
test program

Comment 2 Jakub Jelinek 2003-09-26 13:56:07 UTC
IMHO glibc is right:
- A numeric host address string is not a ``name'', and thus does not have a ``canonical name'' form
- if the canonical name is not available, then ai_canonname shall refer to the nodename argument or a string with the same contents.

Comment 3 David Woodhouse 2003-09-26 14:01:41 UTC
So it would be wrong to do a reverse-dns lookup for _any_ numerical input string?
And hence _this_ would be a bug....

$ ./asd
getaddrinfo() succeeded, result dwmw2.baythorne.internal


Comment 4 Ulrich Drepper 2004-09-28 07:09:12 UTC
You are right, for numeric addresses as name parameter ai_canonname
must always be a copy of the input string.  I've changed that in the
current CVS code.  Will be in 2.3.3-59 or so.