From: Andrew Bartlett Date: Tue, 15 Mar 2016 02:19:21 +0000 (+1300) Subject: repl_meta_data: Give more information on replication rename behaviour X-Git-Tag: tdb-1.3.10~974 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e1dcd45d9e76ff2324750133d687ba8e952a1e47;p=thirdparty%2Fsamba.git repl_meta_data: Give more information on replication rename behaviour Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 8d5332b7cfd..ccf393ed60d 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -4875,15 +4875,49 @@ static int replmd_replicated_apply_search_callback(struct ldb_request *req, if (ar->objs->dsdb_repl_flags & DSDB_REPL_FLAG_PRIORITISE_INCOMING || !md_remote || !md_local || replmd_replPropertyMetaData1_is_newer(md_local, md_remote)) { + struct GUID_txt_buf p_guid_local; + struct GUID_txt_buf p_guid_remote; + msg = ar->objs->objects[ar->index_current].msg; + + /* Otherwise, just merge on the existing object, force no rename */ + + DEBUG(4,(__location__ ": Looking for new parent for object %s currently under %s " + "as incoming object changing to %s under %s\n", + ldb_dn_get_linearized(ar->search_msg->dn), + GUID_buf_string(&ar->local_parent_guid, &p_guid_local), + ldb_dn_get_linearized(msg->dn), + GUID_buf_string(ar->objs->objects[ar->index_current].parent_guid, + &p_guid_remote))); ret = replmd_replicated_apply_search_for_parent(ar); } else { + struct GUID_txt_buf p_guid_local; + struct GUID_txt_buf p_guid_remote; msg = ar->objs->objects[ar->index_current].msg; /* Otherwise, just merge on the existing object, force no rename */ - DEBUG(4,(__location__ ": Keeping object %s and rejecting older rename to %s\n", - ldb_dn_get_linearized(ar->search_msg->dn), - ldb_dn_get_linearized(msg->dn))); + if (strcmp(ldb_dn_get_linearized(ar->search_msg->dn), + ldb_dn_get_linearized(msg->dn)) == 0) { + if (ar->objs->objects[ar->index_current].parent_guid != NULL && + GUID_equal(&ar->local_parent_guid, + ar->objs->objects[ar->index_current].parent_guid) + == false) { + DEBUG(4,(__location__ ": Keeping object %s at under %s " + "despite incoming object changing parent to %s\n", + ldb_dn_get_linearized(ar->search_msg->dn), + GUID_buf_string(&ar->local_parent_guid, &p_guid_local), + GUID_buf_string(ar->objs->objects[ar->index_current].parent_guid, + &p_guid_remote))); + } + } else { + DEBUG(4,(__location__ ": Keeping object %s at under %s " + " and rejecting older rename to %s under %s\n", + ldb_dn_get_linearized(ar->search_msg->dn), + GUID_buf_string(&ar->local_parent_guid, &p_guid_local), + ldb_dn_get_linearized(msg->dn), + GUID_buf_string(ar->objs->objects[ar->index_current].parent_guid, + &p_guid_remote))); + } /* * This assignment ensures that the strcmp() * and GUID_equal() calls in