From: Andrew Bartlett Date: Tue, 3 May 2016 22:42:41 +0000 (+1200) Subject: dsdb: Use replmd_replPropertyMetaData1_new_should_be_taken in replmd_replicated_apply... X-Git-Tag: tdb-1.3.10~955 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5fee4aa90787237d7a7af11febdc45277a896976;p=thirdparty%2Fsamba.git dsdb: Use replmd_replPropertyMetaData1_new_should_be_taken in replmd_replicated_apply_search_callback() This is the primary handler for renames Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam objs->dsdb_repl_flags & DSDB_REPL_FLAG_PRIORITISE_INCOMING || - !md_remote || !md_local || - replmd_replPropertyMetaData1_is_newer(md_local, md_remote)) { + md_local = replmd_replPropertyMetaData1_find_attid(&omd, DRSUAPI_ATTID_name); + if (!md_local) { + DEBUG(0,(__location__ ": Failed to find name attribute in local LDB replPropertyMetaData for %s\n", + ldb_dn_get_linearized(ar->search_msg->dn))); + return replmd_replicated_request_werror(ar, WERR_DS_DRA_DB_ERROR); + } + + /* + * if there is no name attribute given then we have to assume the + * object we've received has the older name + */ + if (replmd_replPropertyMetaData1_new_should_be_taken( + ar->objs->dsdb_repl_flags & DSDB_REPL_FLAG_PRIORITISE_INCOMING, + 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 */ + /* Merge on the existing object, with rename */ DEBUG(4,(__location__ ": Looking for new parent for object %s currently under %s " "as incoming object changing to %s under %s\n", @@ -5092,7 +5100,11 @@ static int replmd_replicated_apply_search_callback(struct ldb_request *req, 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 */ + /* + * Merge on the existing object, force no + * rename (code below just to explain why in + * the DEBUG() logs) + */ if (strcmp(ldb_dn_get_linearized(ar->search_msg->dn), ldb_dn_get_linearized(msg->dn)) == 0) {