svn commit: samba r15492 - in branches/SAMBA_3_0/source/libads: .

abartlet at samba.org abartlet at samba.org
Sun May 7 15:05:32 GMT 2006


Author: abartlet
Date: 2006-05-07 15:05:32 +0000 (Sun, 07 May 2006)
New Revision: 15492

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

Log:
Without this patch, the LDAP client libs will call abort() in
ldap_get_values_len, because they were handed a NULL msgs pointer, for
example in ads_pull_sid().

This occurs when the AD server fails at the connect stage.  (The
toubled AD server is actually Samba4 in my example).

Andrew Bartlett


Modified:
   branches/SAMBA_3_0/source/libads/ldap_utils.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap_utils.c
===================================================================
--- branches/SAMBA_3_0/source/libads/ldap_utils.c	2006-05-07 15:02:27 UTC (rev 15491)
+++ branches/SAMBA_3_0/source/libads/ldap_utils.c	2006-05-07 15:05:32 UTC (rev 15492)
@@ -48,16 +48,17 @@
 		return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
 	}
 
-	while (count--) {
-		*res = NULL;
-		status = ads_do_search_all(ads, bp, scope, expr, attrs, res);
-		if (ADS_ERR_OK(status)) {
-			DEBUG(5,("Search for %s gave %d replies\n",
-				 expr, ads_count_replies(ads, *res)));
-			SAFE_FREE(bp);
-			return status;
-		}
+	*res = NULL;
+	status = ads_do_search_all(ads, bp, scope, expr, attrs, res);
+	if (ADS_ERR_OK(status)) {
+		DEBUG(5,("Search for %s gave %d replies\n",
+			 expr, ads_count_replies(ads, *res)));
+		SAFE_FREE(bp);
+		return status;
+	}
 
+	while (--count) {
+
 		if (*res) 
 			ads_msgfree(ads, *res);
 		*res = NULL;
@@ -79,6 +80,15 @@
 			SAFE_FREE(bp);
 			return status;
 		}
+
+		*res = NULL;
+		status = ads_do_search_all(ads, bp, scope, expr, attrs, res);
+		if (ADS_ERR_OK(status)) {
+			DEBUG(5,("Search for %s gave %d replies\n",
+				 expr, ads_count_replies(ads, *res)));
+			SAFE_FREE(bp);
+			return status;
+		}
 	}
         SAFE_FREE(bp);
 



More information about the samba-cvs mailing list