From: Andrew Bartlett Date: Tue, 3 May 2016 22:41:15 +0000 (+1200) Subject: dsdb: Use replmd_replPropertyMetaData1_new_should_be_taken in replmd_op_possible_conf... X-Git-Tag: tdb-1.3.10~958 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dae543e04e43dad05c90659b94b78e5e69cce709;p=thirdparty%2Fsamba.git dsdb: Use replmd_replPropertyMetaData1_new_should_be_taken in replmd_op_possible_conflict_callback() 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 8c1f43f8726..1d9549a17ad 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -3898,18 +3898,31 @@ static int replmd_op_possible_conflict_callback(struct ldb_request *req, struct rmd = ar->objs->objects[ar->index_current].meta_data; - /* we decide which is newer based on the RPMD on the name - attribute. See [MS-DRSR] ResolveNameConflict */ + /* + * we decide which is newer based on the RPMD on the name + * attribute. See [MS-DRSR] ResolveNameConflict. + * + * We expect omd_name to be present, as this is from a local + * search, but while rmd_name should have been given to us by + * the remote server, if it is missing we just prefer the + * local name in + * replmd_replPropertyMetaData1_new_should_be_taken() + */ rmd_name = replmd_replPropertyMetaData1_find_attid(rmd, DRSUAPI_ATTID_name); omd_name = replmd_replPropertyMetaData1_find_attid(&omd, DRSUAPI_ATTID_name); - if (!rmd_name || !omd_name) { - DEBUG(0,(__location__ ": Failed to find name attribute in replPropertyMetaData for %s\n", + if (!omd_name) { + DEBUG(0,(__location__ ": Failed to find name attribute in local LDB replPropertyMetaData for %s\n", ldb_dn_get_linearized(conflict_dn))); goto failed; } - rename_incoming_record = !(ar->objs->dsdb_repl_flags & DSDB_REPL_FLAG_PRIORITISE_INCOMING) && - !replmd_replPropertyMetaData1_is_newer(omd_name, rmd_name); + /* + * Should we preserve the current record, and so rename the + * incoming record to be a conflict? + */ + rename_incoming_record + = !replmd_replPropertyMetaData1_new_should_be_taken(ar->objs->dsdb_repl_flags & DSDB_REPL_FLAG_PRIORITISE_INCOMING, + omd_name, rmd_name); if (rename_incoming_record) { struct GUID guid;