s4-ipv6: fixed DNS handling with new IPv6 code
authorAndrew Tridgell <tridge@samba.org>
Tue, 7 Jun 2011 02:35:10 +0000 (12:35 +1000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 7 Jun 2011 02:55:37 +0000 (12:55 +1000)
source4/libcli/resolve/dns_ex.c

index 069ba823c2044ec0dd6516ac68a1f28792713040..cb2d2c3d2cee3e0cf48d205ae1cb18192c5590f7 100644 (file)
@@ -267,7 +267,22 @@ static void run_child_dns_lookup(struct dns_ex_state *state, int fd)
                        port = state->port;
                }
 
-               if (!print_sockaddr_len(addrstr, sizeof(addrstr), (struct sockaddr *)addrs_rr[i]->u.data, addrs_rr[i]->size)) {
+               switch (rr->type) {
+               case rk_ns_t_a:
+                       if (inet_ntop(AF_INET, addrs_rr[i]->u.a,
+                                     addrstr, sizeof(addrstr)) == NULL) {
+                               continue;
+                       }
+                       break;
+#ifdef HAVE_IPV6
+               case rk_ns_t_aaaa:
+                       if (inet_ntop(AF_INET6, (struct in6_addr *)addrs_rr[i]->u.data,
+                                     addrstr, sizeof(addrstr)) == NULL) {
+                               continue;
+                       }
+                       break;
+#endif
+               default:
                        continue;
                }