svn commit: samba r19964 - in branches/SAMBA_4_0/source/lib/ldb: common ldb_tdb

metze at samba.org metze at samba.org
Thu Nov 30 10:03:55 GMT 2006


Author: metze
Date: 2006-11-30 10:03:54 +0000 (Thu, 30 Nov 2006)
New Revision: 19964

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

Log:
make debuging easier and report usefull error messages

metze
Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c	2006-11-30 07:38:40 UTC (rev 19963)
+++ branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c	2006-11-30 10:03:54 UTC (rev 19964)
@@ -237,7 +237,7 @@
 
 	dn = ldb_dn_new(ldb, mem_ctx, (char *)in->data);
 	if ( ! ldb_dn_validate(dn)) {
-		return -1;
+		return LDB_ERR_INVALID_DN_SYNTAX;
 	}
 
 	out->data = (uint8_t *)ldb_dn_alloc_casefold(mem_ctx, dn);

Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c	2006-11-30 07:38:40 UTC (rev 19963)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_index.c	2006-11-30 10:03:54 UTC (rev 19964)
@@ -110,6 +110,7 @@
 	struct ldb_val v;
 	const struct ldb_attrib_handler *h;
 	char *attr_folded;
+	int r;
 
 	attr_folded = ldb_attr_casefold(ldb, attr);
 	if (!attr_folded) {
@@ -117,10 +118,13 @@
 	}
 
 	h = ldb_attrib_handler(ldb, attr);
-	if (h->canonicalise_fn(ldb, ldb, value, &v) != 0) {
+	r = h->canonicalise_fn(ldb, ldb, value, &v);
+	if (r != LDB_SUCCESS) {
 		/* canonicalisation can be refused. For example, 
 		   a attribute that takes wildcards will refuse to canonicalise
 		   if the value contains a wildcard */
+		ldb_asprintf_errstring(ldb, "Failed to create index key for attribute '%s':%s:%s",
+				       attr, ldb_strerror(r), ldb_errstring(ldb));
 		talloc_free(attr_folded);
 		return NULL;
 	}
@@ -845,7 +849,6 @@
 	dn_key = ltdb_index_key(ldb, el->name, &el->values[v_idx]);
 	if (!dn_key) {
 		talloc_free(msg);
-		errno = ENOMEM;
 		return -1;
 	}
 	talloc_steal(msg, dn_key);



More information about the samba-cvs mailing list