summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2013-03-22 21:58:25 +1100
committerStefan Metzmacher <metze@samba.org>2013-03-25 13:25:30 +0100
commit30adf0cdbae6d9aaf2e72513d9c33267248f20c0 (patch)
tree938570ace85a6dcf2637eaf35614c8a38d98324f
parent5d42260eecfd4f26cc82637ce1bc989083c9eb9d (diff)
downloadsamba-30adf0cdbae6d9aaf2e72513d9c33267248f20c0.tar.gz
samba-30adf0cdbae6d9aaf2e72513d9c33267248f20c0.tar.bz2
samba-30adf0cdbae6d9aaf2e72513d9c33267248f20c0.zip
scripting: Fill the ProvisionNames hash with strings, not ldb.MessageElement or Dn
This avoids the need to fix it up again in samba_upgradedns. Andrew Bartlett Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Mon Mar 25 13:25:30 CET 2013 on sn-devel-104
-rw-r--r--python/samba/provision/__init__.py15
-rwxr-xr-xsource4/scripting/bin/samba_upgradedns16
2 files changed, 8 insertions, 23 deletions
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index ee4cc10dca..252cfd9021 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -201,9 +201,8 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
"configurationNamingContext","rootDomainNamingContext",
"namingContexts"])
- names.configdn = current[0]["configurationNamingContext"]
- configdn = str(names.configdn)
- names.schemadn = current[0]["schemaNamingContext"]
+ names.configdn = current[0]["configurationNamingContext"][0]
+ names.schemadn = current[0]["schemaNamingContext"][0]
if not (ldb.Dn(samdb, basedn) == (ldb.Dn(samdb,
current[0]["defaultNamingContext"][0]))):
raise ProvisioningError(("basedn in %s (%s) and from %s (%s)"
@@ -211,8 +210,8 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
str(current[0]["defaultNamingContext"][0]),
paths.smbconf, basedn)))
- names.domaindn=current[0]["defaultNamingContext"]
- names.rootdn=current[0]["rootDomainNamingContext"]
+ names.domaindn=current[0]["defaultNamingContext"][0]
+ names.rootdn=current[0]["rootDomainNamingContext"][0]
names.ncs=current[0]["namingContexts"]
names.dnsforestdn = None
names.dnsdomaindn = None
@@ -232,7 +231,7 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
# default site name
res3 = samdb.search(expression="(objectClass=site)",
- base="CN=Sites," + configdn, scope=ldb.SCOPE_ONELEVEL, attrs=["cn"])
+ base="CN=Sites," + names.configdn, scope=ldb.SCOPE_ONELEVEL, attrs=["cn"])
names.sitename = str(res3[0]["cn"])
# dns hostname and server dn
@@ -242,8 +241,8 @@ def find_provision_key_parameters(samdb, secretsdb, idmapdb, paths, smbconf,
names.hostname = str(res4[0]["dNSHostName"]).replace("." + names.dnsdomain, "")
server_res = samdb.search(expression="serverReference=%s" % res4[0].dn,
- attrs=[], base=configdn)
- names.serverdn = server_res[0].dn
+ attrs=[], base=names.configdn)
+ names.serverdn = str(server_res[0].dn)
# invocation id/objectguid
res5 = samdb.search(expression="(objectClass=*)",
diff --git a/source4/scripting/bin/samba_upgradedns b/source4/scripting/bin/samba_upgradedns
index f389ef7f4a..3c30090e0f 100755
--- a/source4/scripting/bin/samba_upgradedns
+++ b/source4/scripting/bin/samba_upgradedns
@@ -83,19 +83,6 @@ def find_bind_gid():
return None
-def fix_names(pnames):
- """Convert elements to strings from MessageElement
- """
- names = pnames
- names.rootdn = pnames.rootdn[0]
- names.domaindn = pnames.domaindn[0]
- names.configdn = pnames.configdn[0]
- names.schemadn = pnames.schemadn[0]
- names.root_gid = pnames.root_gid
- names.serverdn = str(pnames.serverdn)
- return names
-
-
def convert_dns_rdata(rdata, serial=1):
"""Convert resource records in dnsRecord format
"""
@@ -270,9 +257,8 @@ if __name__ == '__main__':
paths = get_paths(param, smbconf=lp.configfile)
paths.bind_gid = find_bind_gid()
ldbs = get_ldbs(paths, creds, system_session(), lp)
- pnames = find_provision_key_parameters(ldbs.sam, ldbs.secrets, ldbs.idmap,
+ names = find_provision_key_parameters(ldbs.sam, ldbs.secrets, ldbs.idmap,
paths, lp.configfile, lp)
- names = fix_names(pnames)
if names.domainlevel < DS_DOMAIN_FUNCTION_2003:
logger.error("Cannot create AD based DNS for OS level < 2003")