Fix is_myname_or_ipaddr() to be robust against strange DNS setups.
authorJeremy Allison <jra@samba.org>
Thu, 24 Mar 2011 19:11:02 +0000 (12:11 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 24 Mar 2011 20:07:36 +0000 (13:07 -0700)
commit5176a0b2af1bb16e530412faaa2f36108f312a03
tree6c80fdef8ee87d81d3af446e7ec86e1c5df8eca1
parent72bd60b2fee20dc85c1cc88d5d4e2efdfb74b701
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.
source3/lib/util_sock.c