dsdb: Use replmd_replPropertyMetaData1_new_should_be_taken in replmd_replicated_apply...
authorAndrew Bartlett <abartlet@samba.org>
Tue, 3 May 2016 22:42:05 +0000 (10:42 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 7 Jun 2016 08:28:10 +0000 (10:28 +0200)
This is the main handler for attribute conflicts

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz
source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index b0b17c9a7778937af88319fe7325cc05f3d3553f..121cb280f5009e84d0494786d61cef28fc16a37f 100644 (file)
@@ -4771,26 +4771,10 @@ static int replmd_replicated_apply_merge(struct replmd_replicated_request *ar)
                                continue;
                        }
 
-                       if (ar->objs->dsdb_repl_flags & DSDB_REPL_FLAG_PRIORITISE_INCOMING) {
-                               /*
-                                * if we compare equal then do an
-                                * update. This is used when a client
-                                * asks for a FULL_SYNC, and can be
-                                * used to recover a corrupt
-                                * replica.
-                                *
-                                * This call is a bit tricky, what we
-                                * are doing it turning the 'is_newer'
-                                * call into a 'not is older' by
-                                * swapping i and j, and negating the
-                                * outcome.
-                               */
-                               cmp = !replmd_replPropertyMetaData1_is_newer(&rmd->ctr.ctr1.array[i],
-                                                                            &nmd.ctr.ctr1.array[j]);
-                       } else {
-                               cmp = replmd_replPropertyMetaData1_is_newer(&nmd.ctr.ctr1.array[j],
-                                                                           &rmd->ctr.ctr1.array[i]);
-                       }
+                       cmp = replmd_replPropertyMetaData1_new_should_be_taken(
+                               ar->objs->dsdb_repl_flags,
+                               &nmd.ctr.ctr1.array[j],
+                               &rmd->ctr.ctr1.array[i]);
                        if (cmp) {
                                /* replace the entry */
                                nmd.ctr.ctr1.array[j] = rmd->ctr.ctr1.array[i];