summaryrefslogtreecommitdiff
path: root/swat/install/provision.esp
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-09-07 03:08:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:05:21 -0500
commitf8573766bc17af0afacc5d44d3c3d8234b426dbf (patch)
tree55dfe87448d6332ff48ba6e74fd3226fdd7422f6 /swat/install/provision.esp
parent8f3ab786f03e1bb5bf73fe9d7264b1b0bbb90a75 (diff)
downloadsamba-f8573766bc17af0afacc5d44d3c3d8234b426dbf.tar.gz
samba-f8573766bc17af0afacc5d44d3c3d8234b426dbf.tar.bz2
samba-f8573766bc17af0afacc5d44d3c3d8234b426dbf.zip
r24985: Start to revert us back to the old-style SWAT, while trying not to
loose some of the fixes in the meantime. Andrew Bartlett (This used to be commit 13acff5ed259e7b5859fd2324ea7740b8f9e5fd7)
Diffstat (limited to 'swat/install/provision.esp')
-rw-r--r--swat/install/provision.esp89
1 files changed, 89 insertions, 0 deletions
diff --git a/swat/install/provision.esp b/swat/install/provision.esp
new file mode 100644
index 0000000000..6183722cb4
--- /dev/null
+++ b/swat/install/provision.esp
@@ -0,0 +1,89 @@
+<% page_header("columns", "Provisioning", "install");
+
+ include("/scripting/forms.js");
+ libinclude("base.js");
+ libinclude("provision.js");
+%>
+
+<h1>Samba4 provisioning</h1>
+
+<%
+var f = FormObj("Provisioning", 0, 2);
+var i;
+var lp = loadparm_init();
+
+if (session.authinfo.user_class == "ADMINISTRATOR"
+ || session.authinfo.user_class == "SYSTEM") {
+
+ if (lp.get("realm") == "") {
+ lp.set("realm", lp.get("workgroup") + ".example.com");
+ }
+
+ var subobj = provision_guess();
+ /* Don't supply default password for web interface */
+ subobj.ADMINPASS = "";
+
+ f.add("REALM", "DNS Domain Name");
+ f.add("DOMAIN", "NetBIOS Domain Name");
+ f.add("HOSTNAME", "Hostname");
+ f.add("ADMINPASS", "Administrator Password", "password");
+ f.add("CONFIRM", "Confirm Password", "password");
+ f.add("DOMAINSID", "Domain SID");
+ f.add("HOSTIP", "Host IP");
+ f.add("DEFAULTSITE", "Default Site");
+ f.submit[0] = "Provision";
+ f.submit[1] = "Cancel";
+
+ if (form['submit'] == "Cancel") {
+ redirect("/");
+ }
+
+ if (form['submit'] == "Provision") {
+ for (r in form) {
+ subobj[r] = form[r];
+ }
+ }
+
+ for (i=0;i<f.element.length;i++) {
+ f.element[i].value = subobj[f.element[i].name];
+ }
+
+ if (form['submit'] == "Provision") {
+
+ /* overcome an initially blank smb.conf */
+ lp.set("realm", subobj.REALM);
+ lp.set("workgroup", subobj.DOMAIN);
+ lp.reload();
+ var goodpass = (subobj.CONFIRM == subobj.ADMINPASS);
+
+ if (!goodpass) {
+ write("<h3>Passwords don't match. Please try again.</h3>");
+ f.display();
+ } else if (subobj.ADMINPASS == "") {
+ write("<h3>You must choose an administrator password. Please try again.</h3>");
+ f.display();
+ } else if (!provision_validate(subobj, writefln)) {
+ f.display();
+ } else {
+ var paths = provision_default_paths(subobj);
+ if (!provision(subobj, writefln, false, paths,
+ session.authinfo.session_info, session.authinfo.credentials, false)) {
+ writefln("Provision failed!");
+ } else if (!provision_dns(subobj, writefln, paths,
+ session.authinfo.session_info, session.authinfo.credentials)) {
+ writefln("DNS Provision failed!");
+ } else {
+ writefln("Provision Complete!");
+ }
+ }
+ } else {
+ f.display();
+ }
+} else {
+ redirect("/");
+}
+
+%>
+
+
+<% page_footer(); %>