diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-01-25 09:36:47 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-01-27 20:14:22 +1100 |
commit | b855df254de40d9de0b7f9042564f6d521ab1c5d (patch) | |
tree | cff28b3a15eb9389c71fdbb606ec8a91d2d048b2 | |
parent | 4752731c2eb4abeb0b5da3e33aa3096786301a19 (diff) | |
download | samba-b855df254de40d9de0b7f9042564f6d521ab1c5d.tar.gz samba-b855df254de40d9de0b7f9042564f6d521ab1c5d.tar.bz2 samba-b855df254de40d9de0b7f9042564f6d521ab1c5d.zip |
provision: setup names.dns_backend
If we have a DomainDnsZone partition:
- we use BIND9_DLZ as backend if a dns-<netbiosname> account is available
- otherwise, we use SAMBA_INTERNAL
else:
- we use BIND9_FLATFILE if a dns or dns-<netbiosname> account is available
- otherwise, we use NONE
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source4/scripting/python/samba/provision/__init__.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py index 8f4928ce2b..507582bad5 100644 --- a/source4/scripting/python/samba/provision/__init__.py +++ b/source4/scripting/python/samba/provision/__init__.py @@ -291,6 +291,32 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf, else: names.root_gid = pwd.getpwuid(int(res9[0]["xidNumber"][0])).pw_gid + res10 = samdb.search(expression="(samaccountname=dns)", + scope=ldb.SCOPE_SUBTREE, attrs=["dn"], + controls=["search_options:1:2"]) + if (len(res10) > 0): + has_legacy_dns_account = True + else: + has_legacy_dns_account = False + + res11 = samdb.search(expression="(samaccountname=dns-%s)" % names.netbiosname, + scope=ldb.SCOPE_SUBTREE, attrs=["dn"], + controls=["search_options:1:2"]) + if (len(res11) > 0): + has_dns_account = True + else: + has_dns_account = False + + if names.dnsdomaindn is not None: + if has_dns_account: + names.dns_backend = 'BIND9_DLZ' + else: + names.dns_backend = 'SAMBA_INTERNAL' + elif has_dns_account or has_legacy_dns_account: + names.dns_backend = 'BIND9_FLATFILE' + else: + names.dns_backend = 'NONE' + dns_admins_sid = get_dnsadmins_sid(samdb, names.domaindn) names.name_map['DnsAdmins'] = str(dns_admins_sid) |