diff options
author | Andrew Bartlett <abartlet@samba.org> | 2006-01-06 12:29:06 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2006-01-06 12:29:06 +0000 |
commit | 3649fec056b2f9fd51619b41ebd43833057b5df2 (patch) | |
tree | 7c552fbce8548029d998b221fc1d3a6ea883b3cf /source/scripting | |
parent | 1d164fe98079e3ac52fbbff2f45f7949f329c3cb (diff) | |
download | samba-3649fec056b2f9fd51619b41ebd43833057b5df2.tar.gz samba-3649fec056b2f9fd51619b41ebd43833057b5df2.tar.xz samba-3649fec056b2f9fd51619b41ebd43833057b5df2.zip |
r12739: Add support for using credentials in the provision process.
This should allow us to provision to a 'normal' LDAP server.
Also add in 'session info' hooks (unused). Both of these need to be
hooked in on the webserver.
Andrew Bartlett
Diffstat (limited to 'source/scripting')
-rw-r--r-- | source/scripting/libjs/provision.js | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/source/scripting/libjs/provision.js b/source/scripting/libjs/provision.js index b5f8527bd01..17382cc0147 100644 --- a/source/scripting/libjs/provision.js +++ b/source/scripting/libjs/provision.js @@ -16,6 +16,7 @@ function install_ok() { var lp = loadparm_init(); var ldb = ldb_init(); + ldb.credentials = credentials_cmdline(); if (lp.get("realm") == "") { return false; } @@ -174,19 +175,21 @@ function ldb_erase(ldb) /* setup a ldb in the private dir */ -function setup_ldb(ldif, dbname, subobj) +function setup_ldb(ldif, session_info, credentials, dbname, subobj) { var erase = true; var extra = ""; var ldb = ldb_init(); var lp = loadparm_init(); + ldb.session_info = session_info; + ldb.credentials = credentials; - if (arguments.length >= 4) { - extra = arguments[3]; + if (arguments.length >= 6) { + extra = arguments[5]; } - if (arguments.length == 5) { - erase = arguments[4]; + if (arguments.length == 7) { + erase = arguments[6]; } var src = lp.get("setup directory") + "/" + ldif; @@ -257,12 +260,12 @@ function provision_default_paths(subobj) /* provision samba4 - caution, this wipes all existing data! */ -function provision(subobj, message, blank, paths) +function provision(subobj, message, blank, paths, session_info, credentials) { var data = ""; var lp = loadparm_init(); var sys = sys_init(); - + /* some options need to be upper/lower case */ @@ -291,7 +294,7 @@ function provision(subobj, message, blank, paths) lp.reload(); } message("Setting up secrets.ldb\n"); - setup_ldb("secrets.ldif", paths.secrets, subobj); + setup_ldb("secrets.ldif", session_info, credentials, paths.secrets, subobj); message("Setting up DNS zone file\n"); setup_file("provision.zone", paths.dns, @@ -300,20 +303,20 @@ function provision(subobj, message, blank, paths) var keytab_ok = credentials_update_all_keytabs(); assert(keytab_ok); message("Setting up hklm.ldb\n"); - setup_ldb("hklm.ldif", paths.hklm, subobj); + setup_ldb("hklm.ldif", session_info, credentials, paths.hklm, subobj); message("Setting up sam.ldb attributes\n"); - setup_ldb("provision_init.ldif", paths.samdb, subobj); + setup_ldb("provision_init.ldif", session_info, credentials, paths.samdb, subobj); message("Setting up sam.ldb schema\n"); - setup_ldb("schema.ldif", paths.samdb, subobj, NULL, false); + setup_ldb("schema.ldif", session_info, credentials, paths.samdb, subobj, NULL, false); message("Setting up display specifiers\n"); - setup_ldb("display_specifiers.ldif", paths.samdb, subobj, NULL, false); + setup_ldb("display_specifiers.ldif", session_info, credentials, paths.samdb, subobj, NULL, false); message("Setting up sam.ldb templates\n"); - setup_ldb("provision_templates.ldif", paths.samdb, subobj, NULL, false); + setup_ldb("provision_templates.ldif", session_info, credentials, paths.samdb, subobj, NULL, false); message("Setting up sam.ldb data\n"); - setup_ldb("provision.ldif", paths.samdb, subobj, NULL, false); + setup_ldb("provision.ldif", session_info, credentials, paths.samdb, subobj, NULL, false); if (blank == false) { message("Setting up sam.ldb users and groups\n"); - setup_ldb("provision_users.ldif", paths.samdb, subobj, data, false); + setup_ldb("provision_users.ldif", session_info, credentials, paths.samdb, subobj, data, false); } } @@ -403,12 +406,14 @@ userAccountControl: %u /* add a new user record */ -function newuser(username, unixname, password, message) +function newuser(username, unixname, password, message, subobj, session_info, credentials) { var lp = loadparm_init(); var samdb = lp.get("sam database"); var ldb = ldb_init(); random_init(local); + ldb.session_info = session_info; + ldb.credentials = credentials; /* connect to the sam */ var ok = ldb.connect(samdb); |