summaryrefslogtreecommitdiff
path: root/swat
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-01-13 03:39:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:50:59 -0500
commit58f78fa182c4b4a046b957c89988d34ea2125696 (patch)
tree095fc563234da507b8f366ba98a0eeb0781e339b /swat
parent792951a36535c9345e6027e0940d97d511282302 (diff)
downloadsamba-58f78fa182c4b4a046b957c89988d34ea2125696.tar.gz
samba-58f78fa182c4b4a046b957c89988d34ea2125696.tar.bz2
samba-58f78fa182c4b4a046b957c89988d34ea2125696.zip
r12892: Add a 'Migrate from Windows' page to our installation section in SWAT.
Doing this required reworking ejsnet, particularly so it could take a set of credentials, not just a username and password argument. This required fixing the ejsnet.js test script, which now adds and deletes a user, and is run from 'make test'. This should prevent it being broken again. Deleting a user from ejsnet required that the matching backend be added to libnet, hooking fortunetly onto already existing code for the actual deletion. The js credentials interface now handles the 'set machine account' flag. New functions have been added to provision.js to wrap the basic operations (so we can write a command line version, as well as the web based version). Andrew Bartlett (This used to be commit a5e7c17c348c45e61699cc1626a0d5eae2df4636)
Diffstat (limited to 'swat')
-rw-r--r--swat/install/vampire.esp91
-rw-r--r--swat/menu.js3
2 files changed, 93 insertions, 1 deletions
diff --git a/swat/install/vampire.esp b/swat/install/vampire.esp
new file mode 100644
index 0000000000..bd96f91962
--- /dev/null
+++ b/swat/install/vampire.esp
@@ -0,0 +1,91 @@
+<% page_header("columns", "Windows to Samba Migration", "install");
+
+ include("/scripting/forms.js");
+ libinclude("base.js");
+ libinclude("provision.js");
+
+ var misc = misc_init();
+%>
+
+<h1>Windows to Samba4 domain migration</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", "Realm");
+f.add("DOMAIN", "Domain Name");
+f.add("ADMIN", "Administrator Username");
+f.add("ADMINPASS", "Administrator Password", "password");
+f.add("HOSTNAME", "My Hostname");
+f.add("HOSTGUID", "Host GUID");
+f.add("HOSTIP", "Host IP");
+f.add("DEFAULTSITE", "Default Site");
+f.submit[0] = "Migrate";
+f.submit[1] = "Cancel";
+
+if (form['submit'] == "Cancel") {
+ redirect("/");
+}
+
+if (form['submit'] == "Migrate") {
+ 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'] == "Migrate") {
+ lp.set("realm", subobj.REALM);
+ if (subobj.ADMINPASS == "") {
+ write("<h3>We need the administrator password for the " + subobj.DOMAIN + " domain to proceed. Please try again.</h3>");
+ f.display();
+ } else if (!provision_validate(subobj, writefln)) {
+ f.display();
+ } else {
+ var creds = credentials_init();
+ creds.set_username(form.ADMIN);
+ creds.set_password(form.ADMINPASS);
+ creds.set_domain(form.DOMAIN);
+ creds.set_realm(form.REALM);
+
+ /* Setup a basic database structure, but don't setup any users */
+ if (!provision(subobj, writefln, true, provision_default_paths(subobj),
+ session.authinfo.session_info, session.authinfo.credentials)) {
+ writefln("Provision failed!");
+
+ /* Join domain */
+ } else if (!join_domain(form.DOMAIN, form.HOSTNAME, misc.SEC_CHAN_BDC, creds, writefln)) {
+ writefln("Domain Join failed!");
+
+ } else {
+ /* Vampire */
+ var machine_creds = credentials_init();
+ machine_creds.set_domain(form.DOMAIN);
+ if (!machine_creds.set_machine_account()) {
+ writefln("Failed to access newly setup domain join!");
+ } else if (!vampire(machine_creds, writefln)) {
+ writefln("Failed to syncronsise remote domain into local database!");
+ }
+ }
+ }
+} else {
+ f.display();
+}
+%>
+
+
+<% page_footer(); %>
diff --git a/swat/menu.js b/swat/menu.js
index e28160e16f..07acd300cb 100644
--- a/swat/menu.js
+++ b/swat/menu.js
@@ -40,7 +40,8 @@ swat_menus.install = simple_menu(
"Installation",
"Provisioning", session_uri("/install/provision.esp"),
"New User", session_uri("/install/newuser.esp"),
- "Import from Samba3", session_uri("/install/samba3.esp"));
+ "Import from Samba3", session_uri("/install/samba3.esp"),
+ "Import from Windows", session_uri("/install/vampire.esp"));
swat_menus.nbt_server = simple_menu(