summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-03-14 19:34:54 +1100
committerAmitay Isaacs <amitay@samba.org>2012-03-21 03:16:22 +0100
commitb114043c4641f4559e3b02a0b094153d83bb328e (patch)
tree802b36e887e971885ccf8a590256a4974386d8f1
parentffce812c22932704618bee212f07f43907e78083 (diff)
downloadsamba-b114043c4641f4559e3b02a0b094153d83bb328e.tar.gz
samba-b114043c4641f4559e3b02a0b094153d83bb328e.tar.bz2
samba-b114043c4641f4559e3b02a0b094153d83bb328e.zip
s4-upgradedns: Add DNS partitions in msDS-hasMasterNCs in NTDS settings
Autobuild-User: Amitay Isaacs <amitay@samba.org> Autobuild-Date: Wed Mar 21 03:16:22 CET 2012 on sn-devel-104
-rwxr-xr-xsource4/scripting/bin/samba_upgradedns40
1 files changed, 40 insertions, 0 deletions
diff --git a/source4/scripting/bin/samba_upgradedns b/source4/scripting/bin/samba_upgradedns
index 5d294a14c3..1a42e0c8ce 100755
--- a/source4/scripting/bin/samba_upgradedns
+++ b/source4/scripting/bin/samba_upgradedns
@@ -367,6 +367,46 @@ if __name__ == '__main__':
else:
logger.info("DNS partitions already exist")
+ # Mark that we are hosting DNS partitions
+ try:
+ dns_nclist = [ 'DC=DomainDnsZones,%s' % domaindn,
+ 'DC=ForestDnsZones,%s' % forestdn ]
+
+ msgs = ldbs.sam.search(base=names.serverdn, scope=ldb.SCOPE_DEFAULT,
+ expression='(objectclass=nTDSDSa)',
+ attrs=['hasPartialReplicaNCs',
+ 'msDS-hasMasterNCs'])
+ msg = msgs[0]
+
+ master_nclist = []
+ for nc in msg["msDS-hasMasterNCs"]:
+ master_nclist.append(nc)
+
+ partial_nclist = []
+ for nc in msg["hasPartialReplicaNCs"]:
+ partial_nclist.append(nc)
+
+ modified = False
+ for nc in dns_nclist:
+ if nc not in master_nclist:
+ master_nclist.append(nc)
+ modified = True
+ if nc in partial_nclist:
+ partial_nclist.remove(nc)
+ modified = True
+
+ if modified:
+ 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)
+ except Exception:
+ raise
+
# Check if dns-HOSTNAME account exists and create it if required
try:
dn = 'samAccountName=dns-%s,CN=Principals' % hostname