mirror of
https://github.com/samba-team/samba.git
synced 2025-01-03 01:18:10 +03:00
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
This commit is contained in:
parent
5d42260eec
commit
30adf0cdba
@ -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=*)",
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user