dbcheck: remove indentation level
authorStefan Metzmacher <metze@samba.org>
Thu, 26 Oct 2017 14:30:28 +0000 (16:30 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 24 Nov 2017 14:50:16 +0000 (15:50 +0100)
Check with git show -w

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/dbchecker.py

index 45bfdbf..3ecb17a 100644 (file)
@@ -1008,75 +1008,74 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                                                      res[0].dn)
                 continue
 
-            else:
-                # check the reverse_link is correct if there should be one
-                match_count = 0
-                if reverse_link_name in res[0]:
-                    for v in res[0][reverse_link_name]:
-                        v_guid = dsdb_Dn(self.samdb, v).dn.get_extended_component("GUID")
-                        if v_guid == obj_guid:
-                            match_count += 1
-                if match_count != 1:
-                    reverse_syntax_oid = self.samdb_schema.get_syntax_oid_from_lDAPDisplayName(reverse_link_name)
-                    if syntax_oid == dsdb.DSDB_SYNTAX_BINARY_DN or reverse_syntax_oid == dsdb.DSDB_SYNTAX_BINARY_DN:
-                        if not linkID & 1:
-                            # Forward binary multi-valued linked attribute
-                            forward_count = 0
-                            for w in obj[attrname]:
-                                w_guid = dsdb_Dn(self.samdb, w).dn.get_extended_component("GUID")
-                                if w_guid == guid:
-                                    forward_count += 1
-
-                            if match_count == forward_count:
-                                continue
-
-                            error_count += 1
-
-                            # Add or remove the missing number of backlinks
-                            diff_count = forward_count - match_count
-
-                            # Loop until the difference between the forward and
-                            # the backward links is resolved.
-                            while diff_count != 0:
-                                if diff_count > 0:
-                                    # self.err_missing_backlink(obj, attrname,
-                                    #                          obj.dn.extended_str(),
-                                    #                          reverse_link_name,
-                                    #                          dsdb_dn.dn)
-                                    # diff_count -= 1
-                                    # TODO no method to fix these right now
-                                    self.report("ERROR: Can't fix missing "
-                                                "multi-valued backlinks on %s" % str(dsdb_dn.dn))
-                                    break
-                                else:
-                                    self.err_orphaned_backlink(res[0], reverse_link_name,
-                                                               obj.dn.extended_str(), attrname,
-                                                               dsdb_dn.dn)
-                                    diff_count += 1
+            # check the reverse_link is correct if there should be one
+            match_count = 0
+            if reverse_link_name in res[0]:
+                for v in res[0][reverse_link_name]:
+                    v_guid = dsdb_Dn(self.samdb, v).dn.get_extended_component("GUID")
+                    if v_guid == obj_guid:
+                        match_count += 1
+            if match_count != 1:
+                reverse_syntax_oid = self.samdb_schema.get_syntax_oid_from_lDAPDisplayName(reverse_link_name)
+                if syntax_oid == dsdb.DSDB_SYNTAX_BINARY_DN or reverse_syntax_oid == dsdb.DSDB_SYNTAX_BINARY_DN:
+                    if not linkID & 1:
+                        # Forward binary multi-valued linked attribute
+                        forward_count = 0
+                        for w in obj[attrname]:
+                            w_guid = dsdb_Dn(self.samdb, w).dn.get_extended_component("GUID")
+                            if w_guid == guid:
+                                forward_count += 1
+
+                        if match_count == forward_count:
+                            continue
 
-                        else:
-                            # If there's a backward link on binary multi-valued linked attribute,
-                            # let the check on the forward link remedy the value.
-                            # UNLESS, there is no forward link detected.
-                            if match_count == 0:
-                                self.err_orphaned_backlink(obj, attrname,
-                                                           val, reverse_link_name,
-                                                           dsdb_dn.dn)
+                        error_count += 1
 
-                        continue
+                        # Add or remove the missing number of backlinks
+                        diff_count = forward_count - match_count
+
+                        # Loop until the difference between the forward and
+                        # the backward links is resolved.
+                        while diff_count != 0:
+                            if diff_count > 0:
+                                # self.err_missing_backlink(obj, attrname,
+                                #                          obj.dn.extended_str(),
+                                #                          reverse_link_name,
+                                #                          dsdb_dn.dn)
+                                # diff_count -= 1
+                                # TODO no method to fix these right now
+                                self.report("ERROR: Can't fix missing "
+                                            "multi-valued backlinks on %s" % str(dsdb_dn.dn))
+                                break
+                            else:
+                                self.err_orphaned_backlink(res[0], reverse_link_name,
+                                                           obj.dn.extended_str(), attrname,
+                                                           dsdb_dn.dn)
+                                diff_count += 1
 
-                    error_count += 1
-                    if linkID & 1:
-                        # Backlink exists, but forward link does not
-                        # Delete the hanging backlink
-                        self.err_orphaned_backlink(obj, attrname, val, reverse_link_name, dsdb_dn.dn)
                     else:
-                        # Forward link exists, but backlink does not
-                        # Add the missing backlink (if the target object is not Deleted Objects?)
-                        if not target_is_deleted:
-                            self.err_missing_backlink(obj, attrname, obj.dn.extended_str(), reverse_link_name, dsdb_dn.dn)
+                        # If there's a backward link on binary multi-valued linked attribute,
+                        # let the check on the forward link remedy the value.
+                        # UNLESS, there is no forward link detected.
+                        if match_count == 0:
+                            self.err_orphaned_backlink(obj, attrname,
+                                                       val, reverse_link_name,
+                                                       dsdb_dn.dn)
+
                     continue
 
+                error_count += 1
+                if linkID & 1:
+                    # Backlink exists, but forward link does not
+                    # Delete the hanging backlink
+                    self.err_orphaned_backlink(obj, attrname, val, reverse_link_name, dsdb_dn.dn)
+                else:
+                    # Forward link exists, but backlink does not
+                    # Add the missing backlink (if the target object is not Deleted Objects?)
+                    if not target_is_deleted:
+                        self.err_missing_backlink(obj, attrname, obj.dn.extended_str(), reverse_link_name, dsdb_dn.dn)
+                continue
+