s4: samba_spnupdate: fix "if we are DNS server" check
authorBjörn Baumbach <bb@sernet.de>
Wed, 1 Aug 2012 13:09:00 +0000 (15:09 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 3 Aug 2012 06:11:33 +0000 (08:11 +0200)
We need to check if we have hasMasterNCs. If we are RODC we have
hasFullReplicaNCs instead of hasMasterNCs.

TODO: maybe check for hasFullReplicaNCs, too?

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source4/scripting/bin/samba_spnupdate

index 69406a8196bdfe688340a1a4368530b9a92c9a3f..977de68bc2c35930ec86a01897e88fbe3e7f47de 100755 (executable)
@@ -130,11 +130,12 @@ res = samdb.search(base=samdb.get_config_basedn(),
 
 basedn = str(samdb.get_default_basedn())
 if len(res) == 1:
-    for e in res[0]["msDS-hasMasterNCs"]:
-        if str(e) == "DC=DomainDnsZones,%s" % basedn:
-            has_domain_dns = True
-        if str(e) == "DC=ForestDnsZones,%s" % basedn:
-            has_forest_dns = True
+    if "msDS-hasMasterNCs" in res[0]:
+        for e in res[0]["msDS-hasMasterNCs"]:
+            if str(e) == "DC=DomainDnsZones,%s" % basedn:
+                has_domain_dns = True
+            if str(e) == "DC=ForestDnsZones,%s" % basedn:
+                has_forest_dns = True
 
 
 # build the spn list