svn commit: samba r19264 - in branches/SAMBA_4_0/source/lib/ldb/common: .

abartlet at samba.org abartlet at samba.org
Fri Oct 13 09:44:56 GMT 2006


Author: abartlet
Date: 2006-10-13 09:44:55 +0000 (Fri, 13 Oct 2006)
New Revision: 19264

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

Log:
Clarify behaviour in ldb_search_callback() and provide more
information when modules fail to load.

Andrew Bartlett


Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c	2006-10-13 09:44:54 UTC (rev 19263)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c	2006-10-13 09:44:55 UTC (rev 19264)
@@ -208,7 +208,8 @@
 	}
 
 	if (ldb_load_modules(ldb, options) != LDB_SUCCESS) {
-		ldb_debug(ldb, LDB_DEBUG_FATAL, "Unable to load modules for '%s'\n", url);
+		ldb_debug(ldb, LDB_DEBUG_FATAL, "Unable to load modules for %s: %s\n",
+			  url, ldb_errstring(ldb));
 		return LDB_ERR_OTHER;
 	}
 
@@ -536,8 +537,9 @@
 	if (!res || !ares) {
 		goto error;
 	}
-
-	if (ares->type == LDB_REPLY_ENTRY) {
+	
+	switch (ares->type) {
+	case LDB_REPLY_ENTRY:
 		res->msgs = talloc_realloc(res, res->msgs, struct ldb_message *, res->count + 2);
 		if (! res->msgs) {
 			goto error;
@@ -547,9 +549,8 @@
 
 		res->msgs[res->count] = talloc_move(res->msgs, &ares->message);
 		res->count++;
-	}
-
-	if (ares->type == LDB_REPLY_REFERRAL) {
+		break;
+	case LDB_REPLY_REFERRAL:
 		if (res->refs) {
 			for (n = 0; res->refs[n]; n++) /*noop*/ ;
 		} else {
@@ -563,8 +564,11 @@
 
 		res->refs[n] = talloc_move(res->refs, &ares->referral);
 		res->refs[n + 1] = NULL;
+	case LDB_REPLY_DONE:
+		/* Should do something here to detect if this never
+		 * happens */
+		break;		
 	}
-
 	talloc_steal(res, ares->controls);
 	talloc_free(ares);
 	return LDB_SUCCESS;



More information about the samba-cvs mailing list