Fix is_myname_or_ipaddr() to be robust against strange DNS setups.
authorJeremy Allison <jra@samba.org>
Thu, 24 Mar 2011 18:55:38 +0000 (11:55 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 14 Jun 2011 10:57:31 +0000 (12:57 +0200)
commit0b1101ae0684186150da58aaf1ca2feb81ce66ae
tree172a8d8e89e35bc5e1b4d5af8715fa33450d1628
parent4b0f3693bed64ab3b3d433e1e45d3e8c56f50afc
Fix is_myname_or_ipaddr() to be robust against strange DNS setups.

If IPv6 DNS names are turned on, but Samba isn't configured to
listen on an IPv6 interface, then is_myname_or_ipaddr() can return
false on a valid DNS name that it should detect is our own. If the
IPv6 addr is returned by preference, then looking at the first addr
only causes is_myname_or_ipaddr() to fail. We need to look at all the
addresses returned by the DNS lookup and check all of them against
our interface list. This is an order N^2 lookup, but there shouldn't
be enough addresses to make this a practical problem.

Jeremy.

Fix bug #8038 - Connecting to a printer can return INVALID_PARAMETER when IPv6
DNS names are turned on.
(cherry picked from commit 80078cb6ef2e6976cb5ab25a86157bca22c836a2)
source3/lib/util_sock.c