]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
replmd: Change replmd_check_singleval_la_conflict() logic flow
authorTim Beale <timbeale@catalyst.net.nz>
Wed, 27 Sep 2017 23:01:34 +0000 (12:01 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 20 Oct 2017 02:05:21 +0000 (04:05 +0200)
Return immediately if there's no conflict, which reduces nesting.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13055

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

index 11275ddf044d0f1b0ce0b2c14ee387f6cbf46797..f18415a137e9ca0c74284070dd5a4cebd211664f 100644 (file)
@@ -7332,38 +7332,38 @@ static int replmd_check_singleval_la_conflict(struct ldb_module *module,
                conflict_pdn = active_pdn;
        }
 
-       /* resolve any single-valued link conflicts */
-       if (conflict_pdn != NULL) {
-
-               DBG_WARNING("Link conflict for %s attribute on %s\n",
-                           attr->lDAPDisplayName, ldb_dn_get_linearized(src_obj_dn));
+       if (conflict_pdn == NULL) {
+               return LDB_SUCCESS;
+       }
 
-               if (replmd_link_update_is_newer(conflict_pdn, la)) {
-                       DBG_WARNING("Using received value %s, over existing target %s\n",
-                                   ldb_dn_get_linearized(dsdb_dn->dn),
-                                   ldb_dn_get_linearized(conflict_pdn->dsdb_dn->dn));
+       /* resolve any single-valued link conflicts */
+       DBG_WARNING("Link conflict for %s attribute on %s\n",
+                   attr->lDAPDisplayName, ldb_dn_get_linearized(src_obj_dn));
 
-                       ret = replmd_delete_link_value(module, replmd_private,
-                                                      old_el, src_obj_dn, schema,
-                                                      attr, seq_num, true,
-                                                      &conflict_pdn->guid,
-                                                      conflict_pdn->dsdb_dn,
-                                                      conflict_pdn->v);
+       if (replmd_link_update_is_newer(conflict_pdn, la)) {
+               DBG_WARNING("Using received value %s, over existing target %s\n",
+                           ldb_dn_get_linearized(dsdb_dn->dn),
+                           ldb_dn_get_linearized(conflict_pdn->dsdb_dn->dn));
 
-                       if (ret != LDB_SUCCESS) {
-                               return ret;
-                       }
-               } else {
-                       DBG_WARNING("Using existing target %s, over received value %s\n",
-                                   ldb_dn_get_linearized(conflict_pdn->dsdb_dn->dn),
-                                   ldb_dn_get_linearized(dsdb_dn->dn));
+               ret = replmd_delete_link_value(module, replmd_private, old_el,
+                                              src_obj_dn, schema, attr,
+                                              seq_num, true, &conflict_pdn->guid,
+                                              conflict_pdn->dsdb_dn,
+                                              conflict_pdn->v);
 
-                       /*
-                        * we want to keep our existing active link and add the
-                        * received link as inactive
-                        */
-                       *add_as_inactive = true;
+               if (ret != LDB_SUCCESS) {
+                       return ret;
                }
+       } else {
+               DBG_WARNING("Using existing target %s, over received value %s\n",
+                           ldb_dn_get_linearized(conflict_pdn->dsdb_dn->dn),
+                           ldb_dn_get_linearized(dsdb_dn->dn));
+
+               /*
+                * we want to keep our existing active link and add the
+                * received link as inactive
+                */
+               *add_as_inactive = true;
        }
 
        return LDB_SUCCESS;