svn commit: samba r17304 - in branches/SAMBA_4_0/source/lib/ldb/ldb_tdb: .

abartlet at samba.org abartlet at samba.org
Sat Jul 29 03:00:18 GMT 2006


Author: abartlet
Date: 2006-07-29 03:00:16 +0000 (Sat, 29 Jul 2006)
New Revision: 17304

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

Log:
Improve ldb_tdb error strings a bit more.

Andrew Bartlett

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


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c	2006-07-29 02:00:33 UTC (rev 17303)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c	2006-07-29 03:00:16 UTC (rev 17304)
@@ -271,6 +271,25 @@
 
 	ret = ltdb_store(module, msg, TDB_INSERT);
 	if (ret != LDB_SUCCESS) {
+		switch (ret) {
+		case LDB_ERR_ENTRY_ALREADY_EXISTS:
+		{
+			TALLOC_CTX *mem_ctx = talloc_new(module);
+			char *errstring, *dn;
+			if (!mem_ctx) {
+				break;
+			}
+			dn = ldb_dn_linearize(mem_ctx, msg->dn);
+			if (!dn) {
+				break;
+			}
+			errstring = talloc_asprintf(mem_ctx, "Entry %s already exists",
+						    dn);
+			ldb_set_errstring(module->ldb, errstring);
+			talloc_free(mem_ctx);
+			break;
+		}
+		}
 		return ret;
 	}
 
@@ -694,7 +713,8 @@
 			if (msg->elements[i].num_values == 0) {
 				if (msg_delete_attribute(module, ldb, msg2, 
 							 msg->elements[i].name) != 0) {
-					err_string = talloc_asprintf(module, "No such attribute: %s", msg->elements[i].name);
+					err_string = talloc_asprintf(module, "No such attribute: %s for delete on %s", 
+								     msg->elements[i].name, dn);
 					if (err_string) ldb_set_errstring(module->ldb, err_string);
 					ret = LDB_ERR_NO_SUCH_ATTRIBUTE;
 					goto failed;
@@ -706,7 +726,8 @@
 						       msg2, 
 						       msg->elements[i].name,
 						       &msg->elements[i].values[j]) != 0) {
-					err_string = talloc_asprintf(module, "No such attribute: %s", msg->elements[i].name);
+					err_string = talloc_asprintf(module, "No matching attribute value when deleting attribute: %s on %s", 
+								     msg->elements[i].name, dn);
 					if (err_string) ldb_set_errstring(module->ldb, err_string);
 					ret = LDB_ERR_NO_SUCH_ATTRIBUTE;
 					goto failed;



More information about the samba-cvs mailing list