summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c17
1 files 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 b9e1852f3b..41292115bb 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));