diff options
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 25 |
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; |