diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-08-24 15:32:57 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-08-26 14:06:07 +0200 |
commit | 607d7c5cdfc6575ac24df7c8996c11c9679abb44 (patch) | |
tree | 43ce8df0e7e72c633f6df1b2729c4a5d13b14bd2 /source4/scripting | |
parent | 322b5253f44f301362cb428175b0f22f358d4931 (diff) | |
download | samba-607d7c5cdfc6575ac24df7c8996c11c9679abb44.tar.gz samba-607d7c5cdfc6575ac24df7c8996c11c9679abb44.tar.bz2 samba-607d7c5cdfc6575ac24df7c8996c11c9679abb44.zip |
s4-provision Use samba.dns_name_to_dn
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/python/samba/__init__.py | 4 | ||||
-rw-r--r-- | source4/scripting/python/samba/provision/__init__.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py index 76eb44ce92..03ee6faa59 100644 --- a/source4/scripting/python/samba/__init__.py +++ b/source4/scripting/python/samba/__init__.py @@ -339,6 +339,10 @@ def ensure_external_module(modulename, location): import_bundled_package(modulename, location) +def dn_from_dns_name(dnsdomain): + """return a DN from a DNS name domain/forest root""" + return "DC=" + ",DC=".join(dnsdomain.split(".")) + from samba import _glue version = _glue.version interface_ips = _glue.interface_ips diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py index 50dff9d086..1799663137 100644 --- a/source4/scripting/python/samba/provision/__init__.py +++ b/source4/scripting/python/samba/provision/__init__.py @@ -225,8 +225,8 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf, lp) # NT domain, kerberos realm, root dn, domain dn, domain dns name names.domain = string.upper(lp.get("workgroup")) names.realm = lp.get("realm") - basedn = "DC=" + names.realm.replace(".",",DC=") names.dnsdomain = names.realm.lower() + basedn = samba.dn_from_dns_name(names.dnsdomain) names.realm = string.upper(names.realm) # netbiosname # Get the netbiosname first (could be obtained from smb.conf in theory) @@ -619,7 +619,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, raise ProvisioningError("guess_names: Workgroup '%s' in smb.conf must match chosen domain '%s'! Please remove the %s file and let provision generate it" % (lp.get("workgroup").upper(), domain, lp.configfile)) if domaindn is None: - domaindn = "DC=" + dnsdomain.replace(".", ",DC=") + domaindn = samba.dn_from_dns_name(dnsdomain) if domain == netbiosname: raise ProvisioningError("guess_names: Domain '%s' must not be equal to short host name '%s'!" % (domain, netbiosname)) |