svn commit: samba r17129 - in branches/SAMBA_3_0_23/source/libsmb: .

jra at samba.org jra at samba.org
Wed Jul 19 05:12:21 GMT 2006


Author: jra
Date: 2006-07-19 05:12:21 +0000 (Wed, 19 Jul 2006)
New Revision: 17129

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17129

Log:
Added tridge's fix for resolve_ads().

Original message :

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)


Modified:
   branches/SAMBA_3_0_23/source/libsmb/namequery.c


Changeset:
Modified: branches/SAMBA_3_0_23/source/libsmb/namequery.c
===================================================================
--- branches/SAMBA_3_0_23/source/libsmb/namequery.c	2006-07-19 01:30:30 UTC (rev 17128)
+++ branches/SAMBA_3_0_23/source/libsmb/namequery.c	2006-07-19 05:12:21 UTC (rev 17129)
@@ -1051,16 +1051,18 @@
 		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 @@
 		   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;
 }



More information about the samba-cvs mailing list