diff options
author | Andrew Bartlett <abartlet@samba.org> | 2007-05-29 01:20:47 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:53:00 -0500 |
commit | 5fb459e4fa3201a3d5cbc22c5ff011bfc98a9519 (patch) | |
tree | 7bfef694058416ed31fcce643f65b04977fcd419 /source4/scripting/libjs | |
parent | b8b580dbcb0468306b89e0a37589700dee6ca7b8 (diff) | |
download | samba-5fb459e4fa3201a3d5cbc22c5ff011bfc98a9519.tar.gz samba-5fb459e4fa3201a3d5cbc22c5ff011bfc98a9519.tar.bz2 samba-5fb459e4fa3201a3d5cbc22c5ff011bfc98a9519.zip |
r23177: Add in a new provision-backend script. This helps set up the OpenLDAP or Fedora DS backend.
This required a new mkdir() call in ejs.
We can now provision just the schema for ad2oLschema to operate on
(with provision_schema(), without performing the whole provision, just
to wipe it again (adjustments to 'make test' to come soon).
Andrew Bartlett
(This used to be commit 01d54d13dc66ef2127ac52c64ede53d0790738ec)
Diffstat (limited to 'source4/scripting/libjs')
-rw-r--r-- | source4/scripting/libjs/provision.js | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js index d9bdb3b16b..d25c0f38eb 100644 --- a/source4/scripting/libjs/provision.js +++ b/source4/scripting/libjs/provision.js @@ -388,6 +388,7 @@ function provision_default_paths(subobj) paths.ldap_basedn_ldif = lp.get("private dir") + "/" + subobj.DNSDOMAIN + ".ldif"; paths.ldap_config_basedn_ldif = lp.get("private dir") + "/" + subobj.DNSDOMAIN + "-config.ldif"; paths.ldap_schema_basedn_ldif = lp.get("private dir") + "/" + subobj.DNSDOMAIN + "-schema.ldif"; + paths.ldapdir = lp.get("private dir") + "/ldap"; return paths; } @@ -446,10 +447,11 @@ function provision_fix_subobj(subobj, message, paths) var rdns = split(",", subobj.DOMAINDN); subobj.RDN_DC = substr(rdns[0], strlen("DC=")); - subobj.SAM_LDB = paths.samdb; - subobj.SECRETS_LDB = paths.secrets; + subobj.SAM_LDB = "tdb://" + paths.samdb; subobj.SECRETS_KEYTAB = paths.keytab; + subobj.LDAPDIR = paths.ldapdir; + return true; } @@ -703,6 +705,53 @@ function provision(subobj, message, blank, paths, session_info, credentials, lda return true; } +/* + provision just the schema into a temporary ldb, so we can run ad2oLschema on it +*/ +function provision_schema(subobj, message, tmp_schema_path, paths) +{ + var lp = loadparm_init(); + var sys = sys_init(); + var info = new Object(); + + var ok = provision_fix_subobj(subobj, message, paths); + assert(ok); + + info.subobj = subobj; + info.message = message; + + message("Setting up sam.ldb partitions\n"); + + /* This will erase anything in the tmp db */ + var samdb = open_ldb(info, tmp_schema_path, true); + + message("Adding schema container (permitted to fail)\n"); + var add_ok = setup_add_ldif("provision_schema_basedn.ldif", info, samdb, true); + message("Modifying schema container\n"); + var modify_ok = setup_ldb_modify("provision_schema_basedn_modify.ldif", info, samdb); + if (!modify_ok) { + if (!add_ok) { + message("Failed to both add and modify schema dn: + samdb.errstring() + "\n"); + message("Perhaps you need to run the provision script with the --ldap-base-dn option, and add this record to the backend manually\n"); + assert(modify_ok); + } + message("Failed to modify the schema container: " + samdb.errstring() + "\n"); + assert(modify_ok); + } + + message("Setting up sam.ldb Samba4 schema\n"); + setup_add_ldif("schema_samba4.ldif", info, samdb, false); + message("Setting up sam.ldb AD schema\n"); + setup_add_ldif("schema.ldif", info, samdb, false); + + var commit_ok = samdb.transaction_commit(); + if (!commit_ok) { + info.message("samdb commit failed: " + samdb.errstring() + "\n"); + assert(commit_ok); + } + samdb.close(); +} + /* Write out a DNS zone file, from the info in the current database */ function provision_dns(subobj, message, paths, session_info, credentials) { @@ -787,6 +836,7 @@ function provision_guess() subobj.KRBTGTPASS = randpass(12); subobj.MACHINEPASS = randpass(12); subobj.ADMINPASS = randpass(12); + subobj.LDAPMANAGERPASS = randpass(12); subobj.DEFAULTSITE = "Default-First-Site-Name"; subobj.NEWGUID = randguid; subobj.NTTIME = nttime; |