From 54b83ce9b7bb70e26f8c83bc0ed7fcf5b8985399 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 29 Jul 2012 15:03:21 +1000 Subject: [PATCH] s4-dsdb: Do not strip base components off DN before searching for NC root --- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index b9e1852f3b8..41292115bb2 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -3737,13 +3737,8 @@ static int replmd_replicated_apply_search_for_parent_callback(struct ldb_request struct ldb_message *parent_msg = ares->message; struct ldb_message *msg = ar->objs->objects[ar->index_current].msg; struct ldb_dn *parent_dn; - int comp_num = ldb_dn_get_comp_num(msg->dn); - if (comp_num > 1) { - if (!ldb_dn_remove_base_components(msg->dn, comp_num - 1)) { - talloc_free(ares); - return ldb_module_done(ar->req, NULL, NULL, ldb_module_operr(ar->module)); - } - } + int comp_num; + if (!ldb_msg_check_string_attribute(msg, "isDeleted", "TRUE") && ldb_msg_check_string_attribute(parent_msg, "isDeleted", "TRUE")) { /* Per MS-DRSR 4.1.10.6.10 @@ -3790,6 +3785,14 @@ static int replmd_replicated_apply_search_for_parent_callback(struct ldb_request } else { parent_dn = parent_msg->dn; } + + comp_num = ldb_dn_get_comp_num(msg->dn); + if (comp_num > 1) { + if (!ldb_dn_remove_base_components(msg->dn, comp_num - 1)) { + talloc_free(ares); + return ldb_module_done(ar->req, NULL, NULL, ldb_module_operr(ar->module)); + } + } if (!ldb_dn_add_base(msg->dn, parent_dn)) { talloc_free(ares); return ldb_module_done(ar->req, NULL, NULL, ldb_module_operr(ar->module)); -- 2.11.4.GIT