summaryrefslogtreecommitdiff
path: root/source4/scripting/bin
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-04-20 09:39:53 +1000
committerAmitay Isaacs <amitay@samba.org>2012-05-01 05:28:03 +0200
commit813557629f33bdd672a27430d2f073888a0127e5 (patch)
tree98991b8247de1e189682e1426169510c3ec03b1c /source4/scripting/bin
parent6f3e011f84140cad4401ce898450ddb158efa2ed (diff)
downloadsamba-813557629f33bdd672a27430d2f073888a0127e5.tar.gz
samba-813557629f33bdd672a27430d2f073888a0127e5.tar.bz2
samba-813557629f33bdd672a27430d2f073888a0127e5.zip
s4-upgradedns: Update serverdn with only the attributes that have changed
This fixes the issue of ldb 'Operations Error' when trying to modify hasPartialReplicaNCs attribute. Autobuild-User: Amitay Isaacs <amitay@samba.org> Autobuild-Date: Tue May 1 05:28:04 CEST 2012 on sn-devel-104
Diffstat (limited to 'source4/scripting/bin')
-rwxr-xr-xsource4/scripting/bin/samba_upgradedns32
1 files changed, 21 insertions, 11 deletions
diff --git a/source4/scripting/bin/samba_upgradedns b/source4/scripting/bin/samba_upgradedns
index 5a335a91f4..bd6a8b9371 100755
--- a/source4/scripting/bin/samba_upgradedns
+++ b/source4/scripting/bin/samba_upgradedns
@@ -390,24 +390,34 @@ if __name__ == '__main__':
for nc in ncs:
partial_nclist.append(nc)
- modified = False
+ modified_master = False
+ modified_partial = False
for nc in dns_nclist:
if nc not in master_nclist:
master_nclist.append(nc)
- modified = True
+ modified_master = True
if nc in partial_nclist:
partial_nclist.remove(nc)
- modified = True
+ modified_partial = True
- if modified:
+ if modified_master or modified_partial:
logger.debug("Updating msDS-hasMasterNCs and hasPartialReplicaNCs attributes")
- msg["msDS-hasMasterNCs"] = ldb.MessageElement(master_nclist,
- ldb.FLAG_MOD_REPLACE,
- "msDS-hasMasterNCs")
- msg["hasPartialReplicaNCs"] = ldb.MessageElement(partial_nclist,
- ldb.FLAG_MOD_REPLACE,
- "hasPartialReplicaNCs")
- ldbs.sam.modify(msg)
+ m = ldb.Message()
+ m.dn = msg.dn
+ if modified_master:
+ m["msDS-hasMasterNCs"] = ldb.MessageElement(master_nclist,
+ ldb.FLAG_MOD_REPLACE,
+ "msDS-hasMasterNCs")
+ if modified_partial:
+ if partial_nclist:
+ m["hasPartialReplicaNCs"] = ldb.MessageElement(partial_nclist,
+ ldb.FLAG_MOD_REPLACE,
+ "hasPartialReplicaNCs")
+ else:
+ m["hasPartialReplicaNCs"] = ldb.MessageElement(ncs,
+ ldb.FLAG_MOD_DELETE,
+ "hasPartialReplicaNCs")
+ ldbs.sam.modify(m)
except Exception:
raise