summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-07-29 03:00:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:15:09 -0500
commitce20796be2e7259943afa203a2f1a471eaa6776a (patch)
tree36d3e69387f710839c33e58b404985c618b79f45
parent5d7b99804acb921496248956542645889b05e928 (diff)
downloadsamba-ce20796be2e7259943afa203a2f1a471eaa6776a.tar.gz
samba-ce20796be2e7259943afa203a2f1a471eaa6776a.tar.bz2
samba-ce20796be2e7259943afa203a2f1a471eaa6776a.zip
r17304: Improve ldb_tdb error strings a bit more.
Andrew Bartlett (This used to be commit 38bd4f61794e5a664822240d77c1e1c61abc7c44)
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 1401052955..cbc9d61613 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -271,6 +271,25 @@ static int ltdb_add_internal(struct ldb_module *module, const struct ldb_message
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 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
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 @@ int ltdb_modify_internal(struct ldb_module *module, const struct ldb_message *ms
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;