1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-27 14:04:05 +03:00
samba-mirror/swat/install/provision.esp
Andrew Bartlett f3db23ac75 r12928: This patch improves the interaction between the vampire and provsion code.
Previously, we had to know (or guess) the host and domain guid at the
provision stage.  Now we query the database post-provision, to extract
the values and fill in the zone file.

This allows us to generate a correct zone file in the Windows migration case.

In an effort to make SWAT easier to use, I have removed and renamed
some of the provision options.

I have also fixed a nasty issue in my js code.  I had implictly
declared a global variable of the name 'join', with disasterious
results for any subsequent user of the string utility function:

esp exception - ASSERT at lib/appweb/ejs/ejsParser.c:2064, 0

Backtrace:
        [ 0]       substitute_var:20   ->               list[i] = join("", list2)
        [ 1]           setup_file:9    ->       data = substitute_var(data, subobj)

Andrew Bartlett
(This used to be commit a38ceefd11f8b748f30383ef36a4752f178bfca1)
2007-10-10 13:51:07 -05:00

80 lines
1.9 KiB
Plaintext

<% 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 (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") {
lp.set("realm", subobj.REALM);
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)) {
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();
}
%>
<% page_footer(); %>