summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2012-04-11 17:18:37 +0200
committerAndrew Tridgell <tridge@samba.org>2012-04-18 07:48:05 +0200
commit8c9c6f869d7f6e991806be344f582191d701b77c (patch)
tree21d0cc055897d81c116ff7345f1a7bfdaf8540bf /source4
parenta2a9c334c10b259d070a984a61656ae76a95a643 (diff)
downloadsamba-8c9c6f869d7f6e991806be344f582191d701b77c.tar.gz
samba-8c9c6f869d7f6e991806be344f582191d701b77c.tar.bz2
samba-8c9c6f869d7f6e991806be344f582191d701b77c.zip
s4:dbchecker.py - integrate the "objectClass" fixing code
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/python/samba/dbchecker.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/dbchecker.py b/source4/scripting/python/samba/dbchecker.py
index d866b3cbee..27bdf3d6b2 100644
--- a/source4/scripting/python/samba/dbchecker.py
+++ b/source4/scripting/python/samba/dbchecker.py
@@ -163,6 +163,26 @@ class dbcheck(object):
validate=False):
self.report("Normalised attribute %s" % attrname)
+ def err_normalise_mismatch_replace(self, dn, attrname, values):
+ '''fix attribute normalisation errors'''
+ normalised = self.samdb.dsdb_normalise_attributes(self.samdb_schema, attrname, values)
+ self.report("ERROR: Normalisation error for attribute '%s' in '%s'" % (attrname, dn))
+ self.report("Values/Order of values do/does not match: %s/%s!" % (values, list(normalised)))
+ if list(normalised) == values:
+ return
+ if not self.confirm_all("Fix normalisation for '%s' from '%s'?" % (attrname, dn), 'fix_all_normalisation'):
+ self.report("Not fixing attribute '%s'" % attrname)
+ return
+
+ m = ldb.Message()
+ m.dn = dn
+ m[attrname] = ldb.MessageElement(normalised, ldb.FLAG_MOD_REPLACE, attrname)
+
+ if self.do_modify(m, ["relax:0", "show_recycled:1"],
+ "Failed to normalise attribute %s" % attrname,
+ validate=False):
+ self.report("Normalised attribute %s" % attrname)
+
def is_deleted_objects_dn(self, dsdb_dn):
'''see if a dsdb_Dn is the special Deleted Objects DN'''
return dsdb_dn.prefix == "B:32:18E2EA80684F11D2B9AA00C04F79F805:"
@@ -422,6 +442,13 @@ class dbcheck(object):
got_repl_property_meta_data = True
continue
+ if str(attrname).lower() == 'objectclass':
+ normalised = self.samdb.dsdb_normalise_attributes(self.samdb_schema, attrname, list(obj[attrname]))
+ if list(normalised) != list(obj[attrname]):
+ self.err_normalise_mismatch_replace(dn, attrname, list(obj[attrname]))
+ error_count += 1
+ continue
+
# check for empty attributes
for val in obj[attrname]:
if val == '':