summaryrefslogtreecommitdiff
path: root/source4/setup
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-29 15:54:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:55 -0500
commit0a72d9a5f7c8705a68b03e2f391603252d896342 (patch)
treee90e15175709ee7e9547317129f4754b21277e88 /source4/setup
parent0549763600b26fadac443555e1cbec5680f91340 (diff)
downloadsamba-0a72d9a5f7c8705a68b03e2f391603252d896342.tar.gz
samba-0a72d9a5f7c8705a68b03e2f391603252d896342.tar.bz2
samba-0a72d9a5f7c8705a68b03e2f391603252d896342.zip
r9744: - [upgrade.js] Start working on smb.conf conversion.
- [ldb_map] Support storing non-mappable data in a fallback LDB (This used to be commit 435e4c6389b9d9b545beec8036289620ee5883db)
Diffstat (limited to 'source4/setup')
-rw-r--r--source4/setup/upgrade55
1 files changed, 50 insertions, 5 deletions
diff --git a/source4/setup/upgrade b/source4/setup/upgrade
index 447e5ee4f9..5d0b14bdd7 100644
--- a/source4/setup/upgrade
+++ b/source4/setup/upgrade
@@ -10,6 +10,8 @@ options = GetOptions(ARGV,
"POPT_AUTOHELP",
"POPT_COMMON_SAMBA",
"POPT_COMMON_VERSION",
+ 'ldif',
+ 'dn=s',
'quiet', 'blank');
if (options == undefined) {
@@ -31,6 +33,13 @@ function message()
}
}
+function ldifprint(data)
+{
+ if (options["ldif"] != undefined) {
+ print data;
+ }
+}
+
/*
show some help
*/
@@ -40,6 +49,7 @@ function ShowHelp()
Samba4 import tool
provision [options] <libdir> <smbconf>
+ --ldif Dump LDIF
--quiet Be quiet
--blank do not add users or groups, just the structure
@@ -54,6 +64,10 @@ if (options.ARGV.length != 2) {
exit(1);
}
+if (options.dn == undefined) {
+ options.dn = "dc=example,dc=org";
+}
+
message("Reading Samba3 databases and smb.conf\n");
var samba3 = samba3_read(options.ARGV[0], options.ARGV[1]);
@@ -63,23 +77,54 @@ if (samba3 == undefined) {
}
message("Writing smb.conf\n");
-// FIXME
+var smbconf = upgrade_smbconf(samba3);
+// FIXME: Write!
message("Provisioning\n");
var subobj = upgrade_provision(samba3);
provision(subobj, message, blank);
+var samdb = ldb_init();
+samdb.connect(lp.get("setup directory") + "/samdb.ldb");
+
message("Importing account policies\n");
-// FIXME
+var ldif = upgrade_policy(samba3);
+ldifprint(ldif);
+samdb.modify(ldif);
+
+// FIXME: Enable samba3sam module if original passdb backend was ldap
message("Importing users\n");
-// FIXME
+for (var i in samba3.samaccounts) {
+ message("Importing user '" + samba3.samaccounts[i].username + "'");
+ var ldif = upgrade_sam_account(samba3.samaccounts[i]);
+ ldifprint(ldif);
+ samdb.add(ldif);
+}
message("Importing groups\n");
-// FIXME
+for (var i in samba3.groupmappings) {
+ message("Importing group '" + samba3.groupmappings[i].username + "'");
+ var ldif = upgrade_sam_group(samba3.groupmappings[i]);
+ ldifprint(ldif);
+ samdb.add(ldif);
+}
message("Importing WINS data\n");
-// FIXME
+var ldif = upgrade_wins(samba3)
+ldifprint(ldif);
+setup_ldb(ldif, "wins", Object());
+
+message("Importing registry data\n");
+var hives = ["hkcr","hkcu","hklm","hkpd"];
+for (var i in hives) {
+ var regdb = ldb_init();
+ regdb.connect(lp.get("setup directory") + "/" + hives[i] + ".ldb");
+ var ldif = upgrade_registry(samba3, hives[i]);
+ ldifprint(ldif);
+ ldb.add(ldif);
+}
+
message("All OK\n");
return 0;