diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-06-22 22:06:18 +1000 |
---|---|---|
committer | Matthieu Patou <mat@samba.org> | 2011-06-22 20:13:08 +0200 |
commit | 2f4251c389f5fa92bfba10739677a760f0bdf198 (patch) | |
tree | 5130b2432e0077250e36ec202bb795423e289e7d /source4 | |
parent | 4fe9ebc2e3e09befe8d7a2ce577336eefd9b9694 (diff) | |
download | samba-2f4251c389f5fa92bfba10739677a760f0bdf198.tar.gz samba-2f4251c389f5fa92bfba10739677a760f0bdf198.tar.bz2 samba-2f4251c389f5fa92bfba10739677a760f0bdf198.zip |
dbchecker: cope with a broken link to Deleted Objects
if a DN link to Deleted Objects has a bad GUID, we need to use
show_deleted
Diffstat (limited to 'source4')
-rw-r--r-- | source4/scripting/python/samba/dbchecker.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/dbchecker.py b/source4/scripting/python/samba/dbchecker.py index 2594e9a1fe..d7680eda94 100644 --- a/source4/scripting/python/samba/dbchecker.py +++ b/source4/scripting/python/samba/dbchecker.py @@ -147,14 +147,21 @@ class dbcheck(object): return 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:" + ################################################################ # handle a missing GUID extended DN component def err_incorrect_dn_GUID(self, dn, attrname, val, dsdb_dn, errstr): self.report("ERROR: %s component for %s in object %s - %s" % (errstr, attrname, dn, val)) + controls=["extended_dn:1:1"] + if self.is_deleted_objects_dn(dsdb_dn): + controls.append("show_deleted:1") try: res = self.samdb.search(base=str(dsdb_dn.dn), scope=ldb.SCOPE_BASE, - attrs=[], controls=["extended_dn:1:1"]) + attrs=[], controls=controls) except ldb.LdbError, (enum, estr): self.report("unable to find object for DN %s - cannot fix (%s)" % (dsdb_dn.dn, estr)) return @@ -248,7 +255,7 @@ class dbcheck(object): continue # the target DN might be deleted - if (dsdb_dn.prefix != "B:32:18E2EA80684F11D2B9AA00C04F79F805:" and + if ((not self.is_deleted_objects_dn(dsdb_dn)) and 'isDeleted' in res[0] and res[0]['isDeleted'][0].upper() == "TRUE"): # note that we don't check this for the special wellKnownObjects prefix |