1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s4-provision Remove serverdn parameter from Schema()

We don't need to know the server DN here any more, and it
makes no sense for many callers.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 2010-10-19 09:12:57 +11:00
parent 640fbf833b
commit 4d9b12ae8f
4 changed files with 7 additions and 14 deletions

View File

@ -1671,8 +1671,7 @@ if __name__ == '__main__':
new_ldbs.startTransactions()
# 12)
schema = Schema(setup_path, names.domainsid, schemadn=str(names.schemadn),
serverdn=str(names.serverdn))
schema = Schema(setup_path, names.domainsid, schemadn=str(names.schemadn))
# We create a closure that will be invoked just before schema reload
def schemareloadclosure():
basesam = Ldb(paths.samdb, session_info=session, credentials=creds, lp=lp,

View File

@ -1055,7 +1055,7 @@ def setup_samdb(path, setup_path, session_info, provision_backend, lp, names,
names=names, serverrole=serverrole, schema=schema)
if schema is None:
schema = Schema(setup_path, domainsid, schemadn=names.schemadn, serverdn=names.serverdn)
schema = Schema(setup_path, domainsid, schemadn=names.schemadn)
# Load the database, but don's load the global schema and don't connect quite yet
samdb = SamDB(session_info=session_info, url=None, auto_connect=False,
@ -1465,8 +1465,7 @@ def provision(setup_dir, logger, session_info,
ldapi_url = "ldapi://%s" % urllib.quote(paths.s4_ldapi_path, safe="")
schema = Schema(setup_path, domainsid, invocationid=invocationid, schemadn=names.schemadn,
serverdn=names.serverdn)
schema = Schema(setup_path, domainsid, invocationid=invocationid, schemadn=names.schemadn)
if backend_type == "ldb":
provision_backend = LDBBackend(backend_type,

View File

@ -303,7 +303,7 @@ class OpenLDAPBackend(LDAPBackend):
self.olcseedldif = os.path.join(self.ldapdir, "olc_seed.ldif")
self.schema = Schema(self.setup_path, self.domainsid,
schemadn=self.names.schemadn, serverdn=self.names.serverdn,
schemadn=self.names.schemadn,
files=[setup_path("schema_samba4.ldif")])
def setup_db_config(self, dbdir):
@ -603,7 +603,6 @@ class FDSBackend(LDAPBackend):
self.setup_path,
self.domainsid,
schemadn=self.names.schemadn,
serverdn=self.names.serverdn,
files=[setup_path("schema_samba4.ldif"), self.samba3_ldif],
additional_prefixmap=["1000:1.3.6.1.4.1.7165.2.1", "1001:1.3.6.1.4.1.7165.2.2"])

View File

@ -54,13 +54,12 @@ def get_schema_descriptor(domain_sid):
class Schema(object):
def __init__(self, setup_path, domain_sid, invocationid=None, schemadn=None,
serverdn=None, files=None, override_prefixmap=None, additional_prefixmap=None):
files=None, override_prefixmap=None, additional_prefixmap=None):
"""Load schema for the SamDB from the AD schema files and samba4_schema.ldif
:param samdb: Load a schema into a SamDB.
:param setup_path: Setup path function.
:param schemadn: DN of the schema
:param serverdn: DN of the server
Returns the schema data loaded, to avoid double-parsing when then needing to add it to the db
"""
@ -68,8 +67,6 @@ class Schema(object):
self.schemadn = schemadn
# We need to have the am_rodc=False just to keep some warnings quiet - this isn't a real SAM, so it's meaningless.
self.ldb = SamDB(global_schema=False, am_rodc=False)
if serverdn is not None:
self.ldb.set_ntds_settings_dn("CN=NTDS Settings,%s" % serverdn)
if invocationid is not None:
self.ldb.set_invocation_id(invocationid)
@ -87,7 +84,7 @@ class Schema(object):
self.schema_dn_modify = read_and_sub_file(
setup_path("provision_schema_basedn_modify.ldif"),
{"SCHEMADN": schemadn, "SERVERDN": serverdn})
{"SCHEMADN": schemadn})
descr = b64encode(get_schema_descriptor(domain_sid))
self.schema_dn_add = read_and_sub_file(
@ -174,7 +171,6 @@ def get_dnsyntax_attributes(schemadn,schemaldb):
def ldb_with_schema(setup_dir=None,
schemadn="cn=schema,cn=configuration,dc=example,dc=com",
serverdn="cn=server,cn=servers,cn=default-first-site-name,cn=sites,cn=cn=configuration,dc=example,dc=com",
domainsid=None,
override_prefixmap=None):
"""Load schema for the SamDB from the AD schema files and samba4_schema.ldif
@ -195,4 +191,4 @@ def ldb_with_schema(setup_dir=None,
domainsid = security.random_sid()
else:
domainsid = security.dom_sid(domainsid)
return Schema(setup_path, domainsid, schemadn=schemadn, serverdn=serverdn, override_prefixmap=override_prefixmap)
return Schema(setup_path, domainsid, schemadn=schemadn, override_prefixmap=override_prefixmap)