summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-07-28 09:40:39 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-07-29 22:55:33 +1000
commit056b2151568979fa688654920d1d19b7b9c810d2 (patch)
treefa0e4538ced5468c142fa36294cbcb11a3da842c /source4/dsdb/samdb
parent03a75afa79da19d9c7ac3b4c86b1a402a27e14e5 (diff)
downloadsamba-056b2151568979fa688654920d1d19b7b9c810d2.tar.gz
samba-056b2151568979fa688654920d1d19b7b9c810d2.tar.bz2
samba-056b2151568979fa688654920d1d19b7b9c810d2.zip
s4-dsdb: Change move to lostAndFound to use container in this partiion and add debugging
The logic looking for LostAndFound failed for a user, so add extensive debugging to make this eaiser to trace down in future. Andrew Bartlett
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 6a2fbf4bc6..b9e1852f3b 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -3750,13 +3750,42 @@ static int replmd_replicated_apply_search_for_parent_callback(struct ldb_request
* FindBestParentObject we need to move this
* new object under a deleted object to
* lost-and-found */
+ struct ldb_dn *nc_root;
+
+ ret = dsdb_find_nc_root(ldb_module_get_ctx(ar->module), msg, msg->dn, &nc_root);
+ if (ret == LDB_ERR_NO_SUCH_OBJECT) {
+ ldb_asprintf_errstring(ldb_module_get_ctx(ar->module),
+ "No suitable NC root found for %s. "
+ "We need to move this object because parent object %s "
+ "is deleted, but this object is not.",
+ ldb_dn_get_linearized(msg->dn),
+ ldb_dn_get_linearized(parent_msg->dn));
+ return ldb_module_done(ar->req, NULL, NULL, LDB_ERR_OPERATIONS_ERROR);
+ } else if (ret != LDB_SUCCESS) {
+ ldb_asprintf_errstring(ldb_module_get_ctx(ar->module),
+ "Unable to find NC root for %s: %s. "
+ "We need to move this object because parent object %s "
+ "is deleted, but this object is not.",
+ ldb_dn_get_linearized(msg->dn),
+ ldb_errstring(ldb_module_get_ctx(ar->module)),
+ ldb_dn_get_linearized(parent_msg->dn));
+ return ldb_module_done(ar->req, NULL, NULL, LDB_ERR_OPERATIONS_ERROR);
+ }
ret = dsdb_wellknown_dn(ldb_module_get_ctx(ar->module), msg,
- ldb_get_default_basedn(ldb_module_get_ctx(ar->module)),
+ nc_root,
DS_GUID_LOSTANDFOUND_CONTAINER,
&parent_dn);
if (ret != LDB_SUCCESS) {
- return ldb_module_done(ar->req, NULL, NULL, ldb_module_operr(ar->module));
+ ldb_asprintf_errstring(ldb_module_get_ctx(ar->module),
+ "Unable to find LostAndFound Container for %s "
+ "in partition %s: %s. "
+ "We need to move this object because parent object %s "
+ "is deleted, but this object is not.",
+ ldb_dn_get_linearized(msg->dn), ldb_dn_get_linearized(nc_root),
+ ldb_errstring(ldb_module_get_ctx(ar->module)),
+ ldb_dn_get_linearized(parent_msg->dn));
+ return ldb_module_done(ar->req, NULL, NULL, LDB_ERR_OPERATIONS_ERROR);
}
} else {
parent_dn = parent_msg->dn;