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

abartlet at samba.org abartlet at samba.org
Tue Nov 13 04:32:37 GMT 2007


Author: abartlet
Date: 2007-11-13 04:32:36 +0000 (Tue, 13 Nov 2007)
New Revision: 25934

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

Log:
Handle a LDB_ERR_NO_SUCH_OBJECT return value when looking for the
modules.

This will be useful when we start enforcing validity in base DNs. 

Andrew Bartlett

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


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c	2007-11-13 04:31:28 UTC (rev 25933)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_modules.c	2007-11-13 04:32:36 UTC (rev 25934)
@@ -323,24 +323,27 @@
 
 		ret = ldb_search(ldb, mods_dn, LDB_SCOPE_BASE, "", attrs, &res);
 		
-		if (ret != LDB_SUCCESS) {
+		if (ret == LDB_ERR_NO_SUCH_OBJECT) {
+			ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db");
+		} else if (ret != LDB_SUCCESS) {
 			ldb_debug(ldb, LDB_DEBUG_FATAL, "ldb error (%s) occurred searching for modules, bailing out\n", ldb_errstring(ldb));
 			talloc_free(mem_ctx);
 			return -1;
-		}
-		talloc_steal(mods_dn, res);
-		if (res->count == 0 || res->msgs[0]->num_elements == 0) {
-			ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db");
 		} else {
-			if (res->count > 1) {
-				ldb_debug(ldb, LDB_DEBUG_FATAL, "Too many records found (%d), bailing out\n", res->count);
-				talloc_free(mem_ctx);
-				return -1;
+			talloc_steal(mods_dn, res);
+			if (res->count == 0 || res->msgs[0]->num_elements == 0) {
+				ldb_debug(ldb, LDB_DEBUG_TRACE, "no modules required by the db");
+			} else {
+				if (res->count > 1) {
+					ldb_debug(ldb, LDB_DEBUG_FATAL, "Too many records found (%d), bailing out\n", res->count);
+					talloc_free(mem_ctx);
+					return -1;
+				}
+				
+				modules = ldb_modules_list_from_string(ldb, mem_ctx,
+								       (const char *)res->msgs[0]->elements[0].values[0].data);
+				
 			}
-
-			modules = ldb_modules_list_from_string(ldb, mem_ctx,
-							       (const char *)res->msgs[0]->elements[0].values[0].data);
-
 		}
 
 		talloc_free(mods_dn);



More information about the samba-cvs mailing list