diff options
author | Andrew Bartlett <abartlet@samba.org> | 2007-12-05 00:40:48 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:48:15 +0100 |
commit | f5860b5a853c40c9e48f5bb0a87c086d268c53bd (patch) | |
tree | cdfe5c94af464f22950118c85952fdf49371ae15 /source4/scripting/libjs | |
parent | 6d2f6f1aae2fd20dec9ed37019de26c7b33b7d2c (diff) | |
download | samba-f5860b5a853c40c9e48f5bb0a87c086d268c53bd.tar.gz samba-f5860b5a853c40c9e48f5bb0a87c086d268c53bd.tar.bz2 samba-f5860b5a853c40c9e48f5bb0a87c086d268c53bd.zip |
r26298: Use metze's schema loading code to pre-initialise the schema into the
samdb before we start writing entries into it.
In doing so, I realised we still used 'dnsDomain', which is not part
of the standard schema (now removed).
We also set the 'wrong' side of the linked attributes for the
masteredBy on each partition - this is now set in provision_self_join
and backlinks via the linked attributes code.
When we have the schema loaded, we must also have a valid domain SID
loaded, so that the objectclass module works. This required some ejs
glue.
Andrew Bartlett
(This used to be commit b0de08916e8cb59ce6a2ea94bbc9ac0679830ac1)
Diffstat (limited to 'source4/scripting/libjs')
-rw-r--r-- | source4/scripting/libjs/provision.js | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js index 2dfc941a66..b42f3b2580 100644 --- a/source4/scripting/libjs/provision.js +++ b/source4/scripting/libjs/provision.js @@ -563,6 +563,44 @@ function provision_become_dc(subobj, message, erase, paths, session_info) return true; } +function load_schema(subobj, message, samdb) +{ + var lp = loadparm_init(); + var src = lp.get("setup directory") + "/" + "schema.ldif"; + + if (! sys.stat(src)) { + message("Template file not found: %s\n",src); + assert(0); + } + + var schema_data = sys.file_load(src); + + src = lp.get("setup directory") + "/" + "schema_samba4.ldif"; + + if (! sys.stat(src)) { + message("Template file not found: %s\n",src); + assert(0); + } + + schema_data = schema_data + sys.file_load(src); + + schema_data = substitute_var(schema_data, subobj); + + src = lp.get("setup directory") + "/" + "provision_schema_basedn_modify.ldif"; + + if (! sys.stat(src)) { + message("Template file not found: %s\n",src); + assert(0); + } + + var head_data = sys.file_load(src); + head_data = substitute_var(head_data, subobj); + + var ok = samdb.attach_dsdb_schema_from_ldif(head_data, schema_data); + return ok; +} + + /* provision samba4 - caution, this wipes all existing data! */ @@ -648,8 +686,15 @@ function provision(subobj, message, blank, paths, session_info, credentials, lda } samdb.close(); + message("Pre-loading the Samba4 and AD schema\n"); + samdb = open_ldb(info, paths.samdb, false); + samdb.set_domain_sid(subobj.DOMAINSID); + + var load_schema_ok = load_schema(subobj, message, samdb); + assert(load_schema_ok.is_ok); + message("Adding DomainDN: " + subobj.DOMAINDN + " (permitted to fail)\n"); var add_ok = setup_add_ldif("provision_basedn.ldif", info, samdb, true); message("Modifying DomainDN: " + subobj.DOMAINDN + "\n"); @@ -692,16 +737,6 @@ function provision(subobj, message, blank, paths, session_info, credentials, lda message("Setting up sam.ldb AD schema\n"); setup_add_ldif("schema.ldif", info, samdb, false); - // (hack) Reload, now we have the schema loaded. - var commit_ok = samdb.transaction_commit(); - if (!commit_ok) { - info.message("samdb commit failed: " + samdb.errstring() + "\n"); - assert(commit_ok); - } - samdb.close(); - - samdb = open_ldb(info, paths.samdb, false); - message("Setting up sam.ldb configuration data\n"); setup_add_ldif("provision_configuration.ldif", info, samdb, false); |