summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-01-15 09:03:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:51:12 -0500
commitba07f94438560830f9b4470ecd9577b8333475bf (patch)
treeed313d0169b2b2cfcf21844c1cbfdc29b1f317e9
parentd59667fd2192920c8dd33cde8ff25fd5af0e00c3 (diff)
downloadsamba-ba07f94438560830f9b4470ecd9577b8333475bf.tar.gz
samba-ba07f94438560830f9b4470ecd9577b8333475bf.tar.bz2
samba-ba07f94438560830f9b4470ecd9577b8333475bf.zip
r12945: Try to move closer to getting Samba3 import working again.
There still a few things to work out Andrew Bartlett (This used to be commit 701558b5fe917555416eb0d100ef756f8ef7cf65)
-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);