dbcheck: Add additional tests for the attributeID list
authorAndrew Bartlett <abartlet@samba.org>
Tue, 28 Jul 2015 04:11:54 +0000 (16:11 +1200)
committerStefan Metzmacher <metze@samba.org>
Mon, 24 Aug 2015 21:46:22 +0000 (23:46 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10973

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

index a97b58a0e041bf1a937b120e1155924afb7277f4..9da9cb0156512c07b82e1da146e56569c15fb024 100644 (file)
@@ -1237,6 +1237,20 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
                 if sorted(list_attid_from_md[:-1]) != list_attid_from_md[:-1]:
                     error_count += 1
                     self.err_replmetadata_unsorted_attid(dn, attrname, obj[attrname])
+                else:
+                    # Here we check that the first attid is 0
+                    # (objectClass) and that the last on is the RDN
+                    # from the DN.
+                    rdn_attid = self.samdb_schema.get_attid_from_lDAPDisplayName(dn.get_rdn_name())
+                    if list_attid_from_md[-1] != rdn_attid:
+                        error_count += 1
+                        self.report("ERROR: Not fixing incorrect final attributeID in '%s' on '%s', it should match the RDN %s" %
+                                    (attrname, str(dn), dn.get_rdn_name()))
+
+                    if list_attid_from_md[0] != 0:
+                        error_count += 1
+                        self.report("ERROR: Not fixing incorrect inital attributeID in '%s' on '%s', it should be objectClass" %
+                                    (attrname, str(dn)))
 
                 got_repl_property_meta_data = True
                 continue