[Bug 1057526] Re: getaddrinfo returns PTR name in ai_canonname when using DNS

Greg Hudson 1057526 at bugs.launchpad.net
Thu Jan 3 14:32:40 UTC 2013


I'm attaching a simple test program which can be used to see the
problem, which appears to still be present in 12.10:

$ host ptr-mismatch.kerberos.org
ptr-mismatch.kerberos.org is an alias for www.kerberos.org.
www.kerberos.org has address 18.9.62.44
$ host www.kerberos.org
www.kerberos.org has address 18.9.62.44
$ host 18.9.62.44
44.62.9.18.in-addr.arpa domain name pointer KERBEROS-ORG.MIT.EDU.

$ cc canonname.c
$ ./a.out www.kerberos.org
www.kerberos.org
$ ./a.out -a www.kerberos.org
KERBEROS-ORG.MIT.EDU

$ ./a.out ptr-mismatch.kerberos.org
www.kerberos.org
$ ./a.out -a ptr-mismatch.kerberos.org
KERBEROS-ORG.MIT.EDU

Without AI_ADDRCONFIG, getaddrinfo does the right thing: it follows a
CNAME record (like ptr-mismatch.kerberos.org) and returns the name of
the A record.  With AI_ADDRCONFIG, getaddrinfo performs a PTR lookup.
This also happens if ai_family is set in the hint (e.g. to AF_INET);
that path isn't exercised in the test program.


** Attachment added: "Test program for AI_CANONNAME"
   https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1057526/+attachment/3473305/+files/canonname.c

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to eglibc in Ubuntu.
https://bugs.launchpad.net/bugs/1057526

Title:
  getaddrinfo returns PTR name in ai_canonname when using DNS

Status in “eglibc” package in Ubuntu:
  Incomplete
Status in “eglibc” source package in Precise:
  Incomplete
Status in “eglibc” package in Fedora:
  Unknown

Bug description:
  Got pinged about this, not fixed in 12.04 yet. From the Redhat bug:

  "We have verified that getaddrinfo() does reverse address calls to DNS
  when AI_CANONNAME is passed in hints.ai_flags and returns the PTR name
  of the forward resolved ip address as Canonical name.

  The canonical name is arguably not what is returned by the PTR record
  for various reasons. Aside the fact that PTR record are often not
  under control of the the same people that control the A name, A names
  can also be roundrobin names and return multiple addresses. Picking
  one and returnings its PTR as canonical name seem highly questionable.

  A CNAME -> A name resolution is welcome as the A name is arguably the
  Canonical name of a CNAME. But getaddrinfo shouldn't do PTR requests
  to the DNS.

  We found this when testing ssh+GSSAPI auth on laptops that can properly set the A record for their name usin dynamic DNS updates but cannot change the PTR record of whatever network they are currently travelling in.
  This breaks kerberos which needs the canonical (A record) name to construct the principal name used to request a ticket when rdns = false is set in krb5.conf and GSSAPITrustDNS is set to no in ssh (the default)."

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1057526/+subscriptions




More information about the foundations-bugs mailing list