s3/getdcname: Fix 'net' crash.
authorKumar Thangavelu <Kumar.Thangavelu@riverbed.com>
Fri, 29 May 2009 09:27:38 +0000 (11:27 +0200)
committerKarolin Seeger <kseeger@samba.org>
Fri, 29 May 2009 09:27:38 +0000 (11:27 +0200)
'net' command crashed when attempting to join a
domain. This occurred in a very specific case where
the DC had multiple IPs and one of the IPs was invalid.

Signed-off-by: Volker Lendecke <vl@samba.org>
source3/libsmb/dsgetdcname.c

index 5606b8e7c97fbfee38a7de628772b6db35fb32ae..fb87b4dc9a3c15b78513b7bbb0ac78587b0ed935 100644 (file)
@@ -626,8 +626,8 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx,
 
                struct ip_service_name *r = &dclist[count];
 
-               r->port = dcs[count].port;
-               r->hostname = dcs[count].hostname;
+               r->port = dcs[i].port;
+               r->hostname = dcs[i].hostname;
 
                /* If we don't have an IP list for a name, lookup it up */