diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-07-19 00:13:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:38:13 -0500 |
commit | f2faf11204e3ef0bc6a92554761cb0f0ac2a1103 (patch) | |
tree | 729eea4712d20a85414d2497830a7331d04d8858 /source3 | |
parent | 97c665db90dc957e377f50092d7d8a6f63f5f2c0 (diff) | |
download | samba-f2faf11204e3ef0bc6a92554761cb0f0ac2a1103.tar.gz samba-f2faf11204e3ef0bc6a92554761cb0f0ac2a1103.tar.bz2 samba-f2faf11204e3ef0bc6a92554761cb0f0ac2a1103.zip |
r17124: fixed a bug which caused resolve_ads() to spin forever if one of the
DCs isn't resolvable in DNS. The fix is to leave that DC out of the
returned list of DCs. I think the original code intended that anyway,
just didn't quite get it right ('i' wasn't incremented in that code
path, so the loop didn't terminate)
(This used to be commit d7ec9f3cc0439e9e0f4c98988b14ae2155d931b9)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/namequery.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 0172ab9514..f6dbe3c548 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1051,16 +1051,18 @@ static BOOL resolve_ads(const char *name, int name_type, return False; } - i = 0; - while ( i < numdcs ) { + *return_count = 0; + + for (i=0;i<numdcs;i++) { + struct ip_service *r = &(*return_iplist)[*return_count]; /* use the IP address from the SRV structure if we have one */ if ( is_zero_ip( dcs[i].ip ) ) - (*return_iplist)[i].ip = *interpret_addr2(dcs[i].hostname); + r->ip = *interpret_addr2(dcs[i].hostname); else - (*return_iplist)[i].ip = dcs[i].ip; + r->ip = dcs[i].ip; - (*return_iplist)[i].port = dcs[i].port; + r->port = dcs[i].port; /* make sure it is a valid IP. I considered checking the negative connection cache, but this is the wrong place for it. Maybe only @@ -1069,15 +1071,11 @@ static BOOL resolve_ads(const char *name, int name_type, The standard reason for falling back to netbios lookups is that our DNS server doesn't know anything about the DC's -- jerry */ - if ( is_zero_ip((*return_iplist)[i].ip) ) - continue; - - i++; + if ( ! is_zero_ip(r->ip) ) + (*return_count)++; } TALLOC_FREE( dcs ); - - *return_count = i; return True; } |