s4-resolver: fix bug with DNS servers returning AAAA records when asked for A records
authorMatthieu Patou <mat@matws.net>
Sat, 5 Nov 2011 23:23:41 +0000 (00:23 +0100)
committerMatthieu Patou <mat@samba.org>
Sun, 6 Nov 2011 02:18:00 +0000 (03:18 +0100)
Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Sun Nov  6 03:18:00 CET 2011 on sn-devel-104

source4/libcli/resolve/dns_ex.c

index 993ef43caabbf94d0fe7ff88e5452789eb5b8fe9..20f2c0c03ae57cc1b221fedaa264d33f586c7fe6 100644 (file)
@@ -196,6 +196,8 @@ static struct dns_records_container get_a_aaaa_records(TALLOC_CTX *mem_ctx,
                                return ret;
                        }
 
+                       /* Some servers (Microsoft at least return here AAAA records .... */
+                       count += count_dns_rr(reply2->head, rk_ns_t_aaaa);
                        count2 = count_dns_rr(reply2->head, rk_ns_t_a);
                } else {
                        reply2 = NULL;
@@ -241,8 +243,8 @@ static struct dns_records_container get_a_aaaa_records(TALLOC_CTX *mem_ctx,
                        if (!rr->u.data) {
                                continue;
                        }
-                       rr_to_string(mem_ctx, rr, port);
-                       addrs[total] = rr_to_string(mem_ctx, rr, port);
+
+                       addrs[total] = rr_to_string(addrs, rr, port);
                        if (addrs[total]) {
                                total++;
                        }