diff options
author | Amitay Isaacs <amitay@gmail.com> | 2012-04-20 09:39:53 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2012-05-01 05:28:03 +0200 |
commit | 813557629f33bdd672a27430d2f073888a0127e5 (patch) | |
tree | 98991b8247de1e189682e1426169510c3ec03b1c | |
parent | 6f3e011f84140cad4401ce898450ddb158efa2ed (diff) | |
download | samba-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
-rwxr-xr-x | source4/scripting/bin/samba_upgradedns | 32 |
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 |