From 45b4b8264abd80ed0fe39cbaec202ad8742a17a5 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Fri, 14 Oct 2011 09:27:56 +0200 Subject: s4:repl_meta_data LDB module - always return the original LDB result codes on failure And add "ldb_operr()" before the "return ret" to point out the position where it failed (for "add_time_element" and "add_uint64_element") Reworked after a suggestion by abartlet. --- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'source4/dsdb') diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 090e28fdf5..46094f5f0d 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -2362,12 +2362,14 @@ static int replmd_modify(struct ldb_module *module, struct ldb_request *req) ret = add_time_element(msg, "whenChanged", t); if (ret != LDB_SUCCESS) { talloc_free(ac); + ldb_operr(ldb); return ret; } ret = add_uint64_element(ldb, msg, "uSNChanged", ac->seq_num); if (ret != LDB_SUCCESS) { talloc_free(ac); + ldb_operr(ldb); return ret; } } @@ -2609,12 +2611,14 @@ static int replmd_rename_callback(struct ldb_request *req, struct ldb_reply *are ret = add_time_element(msg, "whenChanged", t); if (ret != LDB_SUCCESS) { talloc_free(ac); + ldb_operr(ldb); return ret; } ret = add_uint64_element(ldb, msg, "uSNChanged", ac->seq_num); if (ret != LDB_SUCCESS) { talloc_free(ac); + ldb_operr(ldb); return ret; } @@ -4725,15 +4729,18 @@ linked_attributes[0]: /* we only change whenChanged and uSNChanged if the seq_num has changed */ - if (add_time_element(msg, "whenChanged", t) != LDB_SUCCESS) { + ret = add_time_element(msg, "whenChanged", t); + if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); - return ldb_operr(ldb); + ldb_operr(ldb); + return ret; } - if (add_uint64_element(ldb, msg, "uSNChanged", - seq_num) != LDB_SUCCESS) { + ret = add_uint64_element(ldb, msg, "uSNChanged", seq_num); + if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); - return ldb_operr(ldb); + ldb_operr(ldb); + return ret; } old_el = ldb_msg_find_element(msg, attr->lDAPDisplayName); -- cgit