summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/scripting/libjs/upgrade.js26
-rwxr-xr-xsource4/setup/upgrade5
-rw-r--r--swat/install/samba3.esp27
3 files changed, 43 insertions, 15 deletions
diff --git a/source4/scripting/libjs/upgrade.js b/source4/scripting/libjs/upgrade.js
index a8f717badc..161195a60d 100644
--- a/source4/scripting/libjs/upgrade.js
+++ b/source4/scripting/libjs/upgrade.js
@@ -513,13 +513,18 @@ function upgrade_smbconf(oldconf,mark)
return newconf;
}
-function upgrade(subobj, samba3, message, paths)
+function upgrade(subobj, samba3, message, paths, session_info, credentials)
{
var ret = 0;
var lp = loadparm_init();
var samdb = ldb_init();
+ samdb.session_info = session_info;
+ samdb.credentials = credentials;
var ok = samdb.connect(paths.samdb);
- assert(ok);
+ if (!ok) {
+ info.message("samdb connect failed: " + samdb.errstring() + "\n");
+ assert(ok);
+ }
message("Writing configuration\n");
var newconf = upgrade_smbconf(samba3.configuration,true);
@@ -528,11 +533,17 @@ function upgrade(subobj, samba3, message, paths)
message("Importing account policies\n");
var ldif = upgrade_sam_policy(samba3,subobj.BASEDN);
ok = samdb.modify(ldif);
- assert(ok);
-
+ if (!ok) {
+ message("samdb load failed: " + samdb.errstring() + "\n");
+ assert(ok);
+ }
var regdb = ldb_init();
ok = regdb.connect(paths.hklm);
- assert(ok);
+ if (!ok) {
+ message("registry connect: " + regdb.errstring() + "\n");
+ assert(ok);
+ }
+
ok = regdb.modify(sprintf("
dn: value=RefusePasswordChange,key=Parameters,key=Netlogon,key=Services,key=CurrentControlSet,key=System,HIVE=NONE
replace: type
@@ -540,7 +551,10 @@ type: 4
replace: data
data: %d
", samba3.policy.refuse_machine_password_change));
- assert(ok);
+ if (!ok) {
+ message("registry load failed: " + regdb.errstring() + "\n");
+ assert(ok);
+ }
message("Importing users\n");
for (var i in samba3.samaccounts) {
diff --git a/source4/setup/upgrade b/source4/setup/upgrade
index 4c1c011b29..bfeba716e4 100755
--- a/source4/setup/upgrade
+++ b/source4/setup/upgrade
@@ -90,12 +90,13 @@ var creds = options.get_credentials();
var system_session = system_session();
var paths = provision_default_paths(subobj);
provision(subobj, message, options.blank, paths, system_session, creds);
-provision_dns(subobj, message, paths, system_session, creds);
-var ret = upgrade(subobj,samba3,message,paths);
+var ret = upgrade(subobj,samba3,message,paths, system_session, creds);
if (ret > 0) {
message("Failed to import %d entries\n", ret);
} else {
+ provision_dns(subobj, message, paths, system_session, creds);
+
message("All OK\n");
}
diff --git a/swat/install/samba3.esp b/swat/install/samba3.esp
index 3c53bd621f..31857c01e9 100644
--- a/swat/install/samba3.esp
+++ b/swat/install/samba3.esp
@@ -69,13 +69,26 @@ if (form['submit'] == "Import") {
confirm_form();
} else {
var paths = provision_default_paths(subobj);
-
- provision(subobj, writefln, true, paths);
- upgrade(subobj, samba3, writefln, paths);
-
- writefln("Reloading smb.conf\n");
- var lp = loadparm_init();
- lp.reload();
+ if (!provision(subobj, writefln, true, paths,
+ session.authinfo.session_info, session.authinfo.credentials)) {
+ writefln("Provision failed!");
+ } else {
+ var ret = upgrade(subobj,samba3,message,paths,
+ session.authinfo.session_info, session.authinfo.credentials);
+ if (ret > 0) {
+ writefln("Failed to import %d entries\n", ret);
+ } else {
+ if (!provision_dns(subobj, writefln, paths,
+ session.authinfo.session_info, session.authinfo.credentials)) {
+ writefln("DNS Provision failed!");
+ } else {
+ writefln("Reloading smb.conf\n");
+ var lp = loadparm_init();
+ lp.reload();
+ writefln("Upgrade Complete!");
+ }
+ }
+ }
}
} else {
var f = FormObj("Import from Samba3", 0, 2);