From bb02fcda5a8704351afcc93171202f8ad342e05e Mon Sep 17 00:00:00 2001
From: Andrew Bartlett <abartlet@samba.org>
Date: Tue, 11 Dec 2007 02:10:46 +0100
Subject: r26389: Merge SWAT changes from alpha2 back into main Samba4 tree.

Andrew Bartlett
(This used to be commit 45747c2041e32063cda7a48c853fbb41d7de1eb0)
---
 swat/install/index.esp     | 4 ++--
 swat/install/provision.esp | 9 +++++----
 swat/install/samba3.esp    | 4 ++--
 swat/install/vampire.esp   | 7 ++++---
 4 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/swat/install/index.esp b/swat/install/index.esp
index 73b7ea24d5..4ba581c1fd 100644
--- a/swat/install/index.esp
+++ b/swat/install/index.esp
@@ -1,7 +1,7 @@
 <% page_header("columns", "Server Installation", "install"); 
 
-if (session.authinfo.user_class == "ADMINISTRATOR"
-	 || session.authinfo.user_class == "SYSTEM") {
+if ((session.authinfo.user_class == "ADMINISTRATOR")
+	 || (session.authinfo.user_class == "SYSTEM")) {
 
 %>
 
diff --git a/swat/install/provision.esp b/swat/install/provision.esp
index 6183722cb4..c6511adb66 100644
--- a/swat/install/provision.esp
+++ b/swat/install/provision.esp
@@ -11,9 +11,8 @@
 var f = FormObj("Provisioning", 0, 2);
 var i;
 var lp = loadparm_init();
-
-if (session.authinfo.user_class == "ADMINISTRATOR"
-	 || session.authinfo.user_class == "SYSTEM") {
+if ((session.authinfo.user_class == "ADMINISTRATOR")
+	 || (session.authinfo.user_class == "SYSTEM")) {
 
 	if (lp.get("realm") == "") {
 		lp.set("realm", lp.get("workgroup") + ".example.com");
@@ -56,6 +55,9 @@ if (session.authinfo.user_class == "ADMINISTRATOR"
 		lp.reload();
 		var goodpass = (subobj.CONFIRM == subobj.ADMINPASS);
 
+		var paths = provision_default_paths(subobj);
+		provision_fix_subobj(subobj, paths);
+
 		if (!goodpass) {
 			write("<h3>Passwords don't match.  Please try again.</h3>");
 			f.display();
@@ -65,7 +67,6 @@ if (session.authinfo.user_class == "ADMINISTRATOR"
 		} 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!");
diff --git a/swat/install/samba3.esp b/swat/install/samba3.esp
index c6fc9f1418..4de942f972 100644
--- a/swat/install/samba3.esp
+++ b/swat/install/samba3.esp
@@ -15,8 +15,8 @@
 <h1>Import from Samba3</h1>
 
 <%
-if (session.authinfo.user_class == "ADMINISTRATOR"
-    || session.authinfo.user_class == "SYSTEM") {
+if ((session.authinfo.user_class == "ADMINISTRATOR")
+	 || (session.authinfo.user_class == "SYSTEM")) {
 
 	if (form['submit'] == "Cancel") {
 		redirect("/");
diff --git a/swat/install/vampire.esp b/swat/install/vampire.esp
index d5b7a73c53..77e9959de3 100644
--- a/swat/install/vampire.esp
+++ b/swat/install/vampire.esp
@@ -14,8 +14,8 @@ var f = FormObj("Provisioning", 0, 2);
 var i;
 var lp = loadparm_init();
 
-if (session.authinfo.user_class == "ADMINISTRATOR"
-	 || session.authinfo.user_class == "SYSTEM") {
+if ((session.authinfo.user_class == "ADMINISTRATOR")
+	 || (session.authinfo.user_class == "SYSTEM")) {
 
 	if (lp.get("realm") == "") {
 		lp.set("realm", lp.get("workgroup") + ".example.com");
@@ -76,7 +76,8 @@ if (session.authinfo.user_class == "ADMINISTRATOR"
 			var session_info = session.authinfo.session_info;
 			var credentials = session.authinfo.credentials;
 
-			info.credentials = credentials;
+			provision_fix_subobj(subobj, paths);
+		
 			info.session_info = session_info;
 			info.message = writefln;
 			info.subobj = subobj;
-- 
cgit