s4-dsdb: Provide a way to force incoming renames to take priority
authorAndrew Bartlett <abartlet@samba.org>
Fri, 8 Jun 2012 02:26:32 +0000 (12:26 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 29 Jul 2012 12:55:33 +0000 (22:55 +1000)
This should mean that a samba-tool drs replicate --full-sync forces a
replication of all objects, regardless of if we think the local name
is newer and regards any local name as being in conflict.

Andrew Bartlett

source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index 03248c28dd15dc66f60fb34eb6fb291f52ded308..6a2fbf4bc6a8c11921d2cc38be5a8eacf3fd214f 100644 (file)
@@ -3466,7 +3466,8 @@ static int replmd_op_possible_conflict_callback(struct ldb_request *req, struct
                goto failed;
        }
 
-       rename_incoming_record = !replmd_replPropertyMetaData1_is_newer(omd_name, rmd_name);
+       rename_incoming_record = !(ar->objs->dsdb_repl_flags & DSDB_REPL_FLAG_PRIORITISE_INCOMING) &&
+               !replmd_replPropertyMetaData1_is_newer(omd_name, rmd_name);
 
        if (rename_incoming_record) {
                struct GUID guid;
@@ -3855,7 +3856,8 @@ static int replmd_replicated_handle_rename(struct replmd_replicated_request *ar,
        md_local  = replmd_replPropertyMetaData1_find_attid(omd, DRSUAPI_ATTID_name);
        /* if there is no name attribute then we have to assume the
           object we've received is in fact newer */
-       if (!md_remote || !md_local ||
+       if (ar->objs->dsdb_repl_flags & DSDB_REPL_FLAG_PRIORITISE_INCOMING ||
+           !md_remote || !md_local ||
            replmd_replPropertyMetaData1_is_newer(md_local, md_remote)) {
                struct ldb_request *req;
                int ret;