From e2d0526c9799a75f87bbbe24f2e5a268df89fea9 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 29 Oct 2007 13:34:00 -0700 Subject: Change our DNS code to cope with AAAA records. A6 records look like a nightmare to use, so ignore them for now. Jeremy. (This used to be commit 814daded90781dc5a5bdd522ea8cfe5d47e6d7a7) --- source3/libsmb/dsgetdcname.c | 14 ++++++++------ source3/libsmb/namequery.c | 9 +++------ 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index bffbd0f8dc..f6c3273084 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -27,7 +27,7 @@ #define DSGETDCNAME_CACHE_TTL 60*15 struct ip_service_name { - struct in_addr ip; + struct sockaddr_storage ss; unsigned port; const char *hostname; }; @@ -625,8 +625,8 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx, /* If we don't have an IP list for a name, lookup it up */ - if (!dcs[i].ips) { - r->ip = *interpret_addr2(dcs[i].hostname); + if (!dcs[i].ss_s) { + interpret_string_addr(&r->ss, dcs[i].hostname, 0); i++; j = 0; } else { @@ -638,7 +638,7 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx, continue; } - r->ip = dcs[i].ips[j]; + r->ss = dcs[i].ss_s[j]; j++; } @@ -650,7 +650,7 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx, * back to netbios lookups is that our DNS server doesn't know * anything about the DC's -- jerry */ - if (!is_zero_ip_v4(r->ip)) { + if (!is_zero_addr(&r->ss)) { (*return_count)++; continue; } @@ -789,8 +789,10 @@ static NTSTATUS process_dc_dns(TALLOC_CTX *mem_ctx, } if (flags & DS_IP_REQUIRED) { + char addr[INET6_ADDRSTRLEN]; + print_sockaddr(addr, sizeof(addr), &dclist[i]->ss); dc_address = talloc_asprintf(mem_ctx, "\\\\%s", - inet_ntoa(dclist[i]->ip)); + addr); dc_address_type = ADS_INET_ADDRESS; } else { dc_address = talloc_asprintf(mem_ctx, "\\\\%s", diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index f4c516921c..dde758b41c 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1341,15 +1341,14 @@ NTSTATUS resolve_ads(const char *name, i = 0; j = 0; while ( i < numdcs && (*return_countport = dcs[i].port; /* If we don't have an IP list for a name, lookup it up */ - if (!dcs[i].ips) { - ip = *interpret_addr2(dcs[i].hostname); + if (!dcs[i].ss_s) { + interpret_string_addr(&r->ss, dcs[i].hostname, 0); i++; j = 0; } else { @@ -1361,12 +1360,10 @@ NTSTATUS resolve_ads(const char *name, continue; } - ip = dcs[i].ips[j]; + r->ss = dcs[i].ss_s[j]; j++; } - in_addr_to_sockaddr_storage(&r->ss, ip); - /* make sure it is a valid IP. I considered checking the * negative connection cache, but this is the wrong place * for it. Maybe only as a hack. After think about it, if -- cgit