1 <% page_header("columns", "Provisioning", "install");
3 include("/scripting/forms.js");
5 libinclude("provision.js");
8 <h1>Samba4 provisioning</h1>
11 var f = FormObj("Provisioning", 0, 2);
13 var lp = loadparm_init();
14 if ((session.authinfo.user_class == "ADMINISTRATOR")
15 || (session.authinfo.user_class == "SYSTEM")) {
17 if (lp.get("realm") == "") {
18 lp.set("realm", lp.get("workgroup") + ".example.com");
21 var subobj = provision_guess();
22 /* Don't supply default password for web interface */
23 subobj.ADMINPASS = "";
25 f.add("REALM", "DNS Domain Name");
26 f.add("DOMAIN", "NetBIOS Domain Name");
27 f.add("HOSTNAME", "Hostname");
28 f.add("ADMINPASS", "Administrator Password", "password");
29 f.add("CONFIRM", "Confirm Password", "password");
30 f.add("DOMAINSID", "Domain SID");
31 f.add("HOSTIP", "Host IP");
32 f.add("DEFAULTSITE", "Default Site");
33 f.submit[0] = "Provision";
34 f.submit[1] = "Cancel";
36 if (form['submit'] == "Cancel") {
40 if (form['submit'] == "Provision") {
46 for (i=0;i<f.element.length;i++) {
47 f.element[i].value = subobj[f.element[i].name];
50 if (form['submit'] == "Provision") {
52 /* overcome an initially blank smb.conf */
53 lp.set("realm", subobj.REALM);
54 lp.set("workgroup", subobj.DOMAIN);
56 var goodpass = (subobj.CONFIRM == subobj.ADMINPASS);
58 var paths = provision_default_paths(subobj);
59 provision_fix_subobj(subobj, paths);
62 write("<h3>Passwords don't match. Please try again.</h3>");
64 } else if (subobj.ADMINPASS == "") {
65 write("<h3>You must choose an administrator password. Please try again.</h3>");
67 } else if (!provision_validate(subobj, writefln)) {
70 if (!provision(subobj, writefln, false, paths,
71 session.authinfo.session_info, session.authinfo.credentials, false)) {
72 writefln("Provision failed!");
73 } else if (!provision_dns(subobj, writefln, paths,
74 session.authinfo.session_info, session.authinfo.credentials)) {
75 writefln("DNS Provision failed!");
77 writefln("Provision Complete!");