mirror of
https://github.com/samba-team/samba.git
synced 2024-12-31 17:18:04 +03:00
python:upgrade/upgradeprovision: use dn.copy to align ldbs
We need to do this when the dn is on a message from another ldb. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
345eb854c3
commit
d38a9e93cf
@ -178,7 +178,7 @@ def add_idmap_entry(idmapdb, sid, xid, xid_type, logger):
|
||||
if found:
|
||||
try:
|
||||
m = ldb.Message()
|
||||
m.dn = msg[0]['dn']
|
||||
m.dn = msg[0]['dn'].copy(m.ldb)
|
||||
m['xidNumber'] = ldb.MessageElement(
|
||||
str(xid), ldb.FLAG_MOD_REPLACE, 'xidNumber')
|
||||
m['type'] = ldb.MessageElement(
|
||||
|
@ -325,7 +325,7 @@ def update_secrets(newsecrets_ldb, secrets_ldb, messagefunc):
|
||||
if len(current) == 0:
|
||||
# No modules present
|
||||
delta = secrets_ldb.msg_diff(ldb.Message(), reference[0])
|
||||
delta.dn = reference[0].dn
|
||||
delta.dn = reference[0].dn.copy(delta.ldb)
|
||||
secrets_ldb.add(reference[0])
|
||||
else:
|
||||
delta = secrets_ldb.msg_diff(current[0], reference[0])
|
||||
@ -366,7 +366,7 @@ def update_secrets(newsecrets_ldb, secrets_ldb, messagefunc):
|
||||
reference[0].dn)
|
||||
for att in delta:
|
||||
messagefunc(CHANGE, " Adding attribute %s" % att)
|
||||
delta.dn = reference[0].dn
|
||||
delta.dn = reference[0].dn.copy(delta.ldb)
|
||||
secrets_ldb.add(delta)
|
||||
|
||||
for entry in listPresent:
|
||||
@ -531,7 +531,7 @@ def delta_update_basesamdb(refsampath, sampath, creds, session, lp, message):
|
||||
if str(refentry.dn) == "@PROVISION" and\
|
||||
delta.get(samba.provision.LAST_PROVISION_USN_ATTRIBUTE):
|
||||
delta.remove(samba.provision.LAST_PROVISION_USN_ATTRIBUTE)
|
||||
delta.dn = refentry.dn
|
||||
delta.dn = refentry.dn.copy(delta.ldb)
|
||||
sam.add(delta)
|
||||
else:
|
||||
delta = sam.msg_diff(entry[0], refentry)
|
||||
@ -541,7 +541,7 @@ def delta_update_basesamdb(refsampath, sampath, creds, session, lp, message):
|
||||
delta.get(samba.provision.LAST_PROVISION_USN_ATTRIBUTE):
|
||||
delta.remove(samba.provision.LAST_PROVISION_USN_ATTRIBUTE)
|
||||
if len(delta.items()) > 1:
|
||||
delta.dn = refentry.dn
|
||||
delta.dn = refentry.dn.copy(delta.ldb)
|
||||
sam.modify(delta)
|
||||
|
||||
return deltaattr
|
||||
|
@ -1031,7 +1031,7 @@ def update_present(ref_samdb, samdb, basedn, listPresent, usns):
|
||||
current, hash_attr_usn,
|
||||
basedn, usns, samdb)
|
||||
|
||||
delta.dn = dn
|
||||
delta.dn = dn.copy(delta.ldb)
|
||||
|
||||
|
||||
if len(delta) >1:
|
||||
@ -1216,7 +1216,7 @@ def fix_wellknown_sd(samdb, names):
|
||||
list_wellknown_dns.append(dn)
|
||||
if dn in dnToRecalculate:
|
||||
delta = Message()
|
||||
delta.dn = dn
|
||||
delta.dn = dn.copy(samdb)
|
||||
descr = descriptor_fn(names.domainsid, name_map=names.name_map)
|
||||
delta["nTSecurityDescriptor"] = MessageElement(descr, FLAG_MOD_REPLACE,
|
||||
"nTSecurityDescriptor" )
|
||||
@ -1250,7 +1250,7 @@ def rebuild_sd(samdb, names):
|
||||
if dn in listWellknown:
|
||||
continue
|
||||
delta = Message()
|
||||
delta.dn = dn
|
||||
delta.dn = dn.copy(samdb)
|
||||
sd_flags = SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL | SECINFO_SACL
|
||||
try:
|
||||
descr = get_empty_descriptor(names.domainsid)
|
||||
|
Loading…
Reference in New Issue
Block a user