Fix bad bugfix for bug #8910 - resolve_ads() code can return zero addresses and miss...
authorIra Cooper <ira@wakeful.net>
Wed, 30 May 2012 18:50:06 +0000 (11:50 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 31 May 2012 18:22:24 +0000 (20:22 +0200)
Original code incorrectly used a while() instead of a for() loop.
We need to iterate over the entire array here.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed May 30 23:29:03 CEST 2012 on sn-devel-104
(cherry picked from commit fc7e1113c34819de6fc8053fb81ee2e0e970bec2)

source3/libsmb/namequery.c

index d0ab62fbbebcc9a0ae921f74151d633cf60e5dde..4ba72042df57c175da014b2d1895fbcd069c3b14 100644 (file)
@@ -1934,7 +1934,7 @@ static NTSTATUS resolve_ads(const char *name,
 
        *return_count = 0;
 
-       while ( i < numdcs && (*return_count<numaddrs) ) {
+       for (i = 0; i < numdcs && (*return_count<numaddrs); i++ ) {
                /* If we don't have an IP list for a name, lookup it up */
                if (!dcs[i].ss_s) {
                        /* We need to get all IP addresses here. */