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>
Wed, 7 Oct 2009 06:54:48 +0000 (08:54 +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>
Fixes bug #6420.
(cherry picked from commit 30cca93674d0dad15ad0ccfaf0d81f94d7d17b4a)

source/libsmb/dsgetdcname.c

index 77c2dcfac4210c08fc3459ca36d71db8c5a64954..714c11b5dd60d5127ef019744dc48bf2275ce174 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 */