summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-10-27 11:10:49 +1100
committerAndrew Tridgell <tridge@samba.org>2009-10-27 11:32:21 +1100
commit8ae0abc65f9023d031c799516efe52cb36c612f5 (patch)
treeea5ad4dacf46cac071934f00480dd2a1e3763af3 /source4/lib
parent5e920f2a232ea0bce366895b0b789b1362e88180 (diff)
downloadsamba-8ae0abc65f9023d031c799516efe52cb36c612f5.tar.gz
samba-8ae0abc65f9023d031c799516efe52cb36c612f5.tar.bz2
samba-8ae0abc65f9023d031c799516efe52cb36c612f5.zip
s4:ldb Add detail to failures in the indexing code
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index 5002de527b..55c5c9c952 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -316,6 +316,7 @@ static int ltdb_index_traverse_store(struct tdb_context *tdb, TDB_DATA key, TDB_
dn = ldb_dn_from_ldb_val(module, ldb, &v);
if (dn == NULL) {
+ ldb_asprintf_errstring(ldb, "Failed to parse index key %*.*s as an LDB DN", (int)v.length, (int)v.length, (const char *)v.data);
ltdb->idxptr->error = LDB_ERR_OPERATIONS_ERROR;
return -1;
}
@@ -334,6 +335,9 @@ int ltdb_index_transaction_commit(struct ldb_module *module)
struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private);
int ret;
+ struct ldb_context *ldb = ldb_module_get_ctx(module);
+
+ ldb_reset_err_string(ldb);
if (ltdb->idxptr->itdb) {
tdb_traverse(ltdb->idxptr->itdb, ltdb_index_traverse_store, module);
tdb_close(ltdb->idxptr->itdb);
@@ -342,8 +346,10 @@ int ltdb_index_transaction_commit(struct ldb_module *module)
ret = ltdb->idxptr->error;
if (ret != LDB_SUCCESS) {
- struct ldb_context *ldb = ldb_module_get_ctx(module);
- ldb_asprintf_errstring(ldb, "Failed to store index records in transaction commit");
+ if (!ldb_errstring(ldb)) {
+ ldb_set_errstring(ldb, ldb_strerror(ret));
+ }
+ ldb_asprintf_errstring(ldb, "Failed to store index records in transaction commit: %s", ldb_errstring(ldb));
}
talloc_free(ltdb->idxptr);