summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2017-10-30 10:51:35 +1300
committerKarolin Seeger <kseeger@samba.org>2017-11-29 09:24:25 +0100
commit68bf2752e22deec5bed1f7ea3aad8850d53bd0c8 (patch)
treee91e570b3c8ec14b4d0c02b15d205e8e97b905a1 /python
parentb7c9edb392f76d557f46cd119c398b874c80ce1e (diff)
downloadsamba-68bf2752e22deec5bed1f7ea3aad8850d53bd0c8.tar.gz
dbcheck: Use the GUID as the DN to fix replPropertyMetaData
This allows this to still work after an object is renamed under the deleted objects container. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit 527f2c95cfe24d29fa34ed19db3b073781d96d9a)
Diffstat (limited to 'python')
-rw-r--r--python/samba/dbchecker.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py
index 8bbd65f4aae..45bfdbf7479 100644
--- a/python/samba/dbchecker.py
+++ b/python/samba/dbchecker.py
@@ -1123,11 +1123,14 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
return (set_att, list_attid, wrong_attids)
- def fix_metadata(self, dn, attr):
+ def fix_metadata(self, obj, attr):
'''re-write replPropertyMetaData elements for a single attribute for a
object. This is used to fix missing replPropertyMetaData elements'''
+ guid_str = str(ndr_unpack(misc.GUID, obj['objectGUID'][0]))
+ dn = ldb.Dn(self.samdb, "<GUID=%s>" % guid_str)
res = self.samdb.search(base = dn, scope=ldb.SCOPE_BASE, attrs = [attr],
- controls = ["search_options:1:2", "show_recycled:1"])
+ controls = ["search_options:1:2",
+ "show_recycled:1"])
msg = res[0]
nmsg = ldb.Message()
nmsg.dn = dn
@@ -1969,7 +1972,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
if not self.confirm_all("Fix missing replPropertyMetaData element '%s'" % att, 'fix_all_metadata'):
self.report("Not fixing missing replPropertyMetaData element '%s'" % att)
continue
- self.fix_metadata(dn, att)
+ self.fix_metadata(obj, att)
if self.is_fsmo_role(dn):
if "fSMORoleOwner" not in obj and ("*" in attrs or "fsmoroleowner" in map(str.lower, attrs)):