cldap: use ipv4 not up for unbound cldap sockets
authorAndrew Tridgell <tridge@samba.org>
Mon, 13 Sep 2010 21:49:12 +0000 (07:49 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 15 Sep 2010 05:39:35 +0000 (15:39 +1000)
If we use "ip" we end up with a PF_INET6 socket which breaks sendto()
for v4 addresses.

libcli/cldap/cldap.c

index 896319e75cdba6373a7b4d06cadaaa2351242afc..33a1bd65715b7a26ff77c160bb8d090f6d66a93b 100644 (file)
@@ -320,7 +320,11 @@ NTSTATUS cldap_socket_init(TALLOC_CTX *mem_ctx,
        c->event.ctx = ev;
 
        if (!local_addr) {
-               ret = tsocket_address_inet_from_strings(c, "ip",
+               /* we use ipv4 here instead of ip, as otherwise we end
+                  up with a PF_INET6 socket, and sendto() for ipv4
+                  addresses will fail. That breaks cldap name
+                  resolution for winbind to IPv4 hosts. */
+               ret = tsocket_address_inet_from_strings(c, "ipv4",
                                                        NULL, 0,
                                                        &any);
                if (ret != 0) {