summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2015-09-24 14:08:37 +1200
committerAndrew Bartlett <abartlet@samba.org>2015-10-26 05:11:21 +0100
commit6cd8e79257a653e5df79c6bebb8689c0203a4f48 (patch)
treee82e9add1bd985f2b5d39ade901eb994cc3682a1 /source4
parent0a924d13cf4bb570cce3955cf0de9d8678b37dbe (diff)
downloadsamba-6cd8e79257a653e5df79c6bebb8689c0203a4f48.tar.gz
repl_meta_data: Print more detail into the LDB error string, not just DEBUG()
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c66
1 files changed, 49 insertions, 17 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 3310d307b01..3e4880e131c 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -3159,16 +3159,17 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request
ldb_dn_escape_value(tmp_ctx, *rdn_value),
GUID_string(tmp_ctx, &guid));
if (!retb) {
- DEBUG(0,(__location__ ": Unable to add a formatted child to dn: %s",
- ldb_dn_get_linearized(new_dn)));
+ ldb_asprintf_errstring(ldb, __location__
+ ": Unable to add a formatted child to dn: %s",
+ ldb_dn_get_linearized(new_dn));
talloc_free(tmp_ctx);
return LDB_ERR_OPERATIONS_ERROR;
}
ret = ldb_msg_add_string(msg, "isDeleted", "TRUE");
if (ret != LDB_SUCCESS) {
- DEBUG(0,(__location__ ": Failed to add isDeleted string to the msg\n"));
- ldb_module_oom(module);
+ ldb_asprintf_errstring(ldb, __location__
+ ": Failed to add isDeleted string to the msg");
talloc_free(tmp_ctx);
return ret;
}
@@ -3182,8 +3183,9 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request
struct ldb_dn *rdn = ldb_dn_copy(tmp_ctx, old_dn);
retb = ldb_dn_remove_base_components(rdn, ldb_dn_get_comp_num(rdn) - 1);
if (!retb) {
- DEBUG(0,(__location__ ": Unable to add a prepare rdn of %s",
- ldb_dn_get_linearized(rdn)));
+ ldb_asprintf_errstring(ldb, __location__
+ ": Unable to add a prepare rdn of %s",
+ ldb_dn_get_linearized(rdn));
talloc_free(tmp_ctx);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -3191,9 +3193,10 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request
retb = ldb_dn_add_child(new_dn, rdn);
if (!retb) {
- DEBUG(0,(__location__ ": Unable to add rdn %s to base dn: %s",
- ldb_dn_get_linearized(rdn),
- ldb_dn_get_linearized(new_dn)));
+ ldb_asprintf_errstring(ldb, __location__
+ ": Unable to add rdn %s to base dn: %s",
+ ldb_dn_get_linearized(rdn),
+ ldb_dn_get_linearized(new_dn));
talloc_free(tmp_ctx);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -3217,29 +3220,48 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request
*/
if (deletion_state == OBJECT_NOT_DELETED) {
+ struct ldb_dn *parent_dn = ldb_dn_get_parent(tmp_ctx, old_dn);
+ char *parent_dn_str = NULL;
+
/* we need the storage form of the parent GUID */
ret = dsdb_module_search_dn(module, tmp_ctx, &parent_res,
- ldb_dn_get_parent(tmp_ctx, old_dn), NULL,
+ parent_dn, NULL,
DSDB_FLAG_NEXT_MODULE |
DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT |
DSDB_SEARCH_REVEAL_INTERNALS|
DSDB_SEARCH_SHOW_RECYCLED, req);
if (ret != LDB_SUCCESS) {
ldb_asprintf_errstring(ldb_module_get_ctx(module),
- "repmd_delete: Failed to %s %s, because we failed to find it's parent (%s): %s",
+ "repmd_delete: Failed to %s %s, "
+ "because we failed to find it's parent (%s): %s",
re_delete ? "re-delete" : "delete",
ldb_dn_get_linearized(old_dn),
- ldb_dn_get_linearized(ldb_dn_get_parent(tmp_ctx, old_dn)),
+ ldb_dn_get_linearized(parent_dn),
ldb_errstring(ldb_module_get_ctx(module)));
talloc_free(tmp_ctx);
return ret;
}
+ /*
+ * Now we can use the DB version,
+ * it will have the extended DN info in it
+ */
+ parent_dn = parent_res->msgs[0]->dn;
+ parent_dn_str = ldb_dn_get_extended_linearized(tmp_ctx,
+ parent_dn,
+ 1);
+ if (parent_dn_str == NULL) {
+ talloc_free(tmp_ctx);
+ return ldb_module_oom(module);
+ }
+
ret = ldb_msg_add_steal_string(msg, "lastKnownParent",
- ldb_dn_get_extended_linearized(tmp_ctx, parent_res->msgs[0]->dn, 1));
+ parent_dn_str);
if (ret != LDB_SUCCESS) {
- DEBUG(0,(__location__ ": Failed to add lastKnownParent string to the msg\n"));
- ldb_module_oom(module);
+ ldb_asprintf_errstring(ldb, __location__
+ ": Failed to add lastKnownParent "
+ "string when deleting %s",
+ ldb_dn_get_linearized(old_dn));
talloc_free(tmp_ctx);
return ret;
}
@@ -3248,8 +3270,10 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request
if (next_deletion_state == OBJECT_DELETED) {
ret = ldb_msg_add_value(msg, "msDS-LastKnownRDN", rdn_value, NULL);
if (ret != LDB_SUCCESS) {
- DEBUG(0,(__location__ ": Failed to add msDS-LastKnownRDN string to the msg\n"));
- ldb_module_oom(module);
+ ldb_asprintf_errstring(ldb, __location__
+ ": Failed to add msDS-LastKnownRDN "
+ "string when deleting %s",
+ ldb_dn_get_linearized(old_dn));
talloc_free(tmp_ctx);
return ret;
}
@@ -3316,6 +3340,14 @@ static int replmd_delete_internals(struct ldb_module *module, struct ldb_request
*/
ret = replmd_delete_remove_link(module, schema, old_dn, el, sa, req);
if (ret != LDB_SUCCESS) {
+ const char *old_dn_str
+ = ldb_dn_get_linearized(old_dn);
+ ldb_asprintf_errstring(ldb,
+ __location__
+ ": Failed to remove backlink of "
+ "%s when deleting %s",
+ el->name,
+ old_dn_str);
talloc_free(tmp_ctx);
return LDB_ERR_OPERATIONS_ERROR;
}