From f58a74aabab3d5c0d1185ac2f77a5f54feb781e9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 31 Aug 2005 02:39:57 +0000 Subject: [PATCH] r9816: Work on testsuite for upgrade Add 'paths' object to provision code. (This used to be commit 488d737fb0ebbc2535d0ec17c14f0dc1eaf2a578) --- source4/lib/samba3/PLAN | 2 +- source4/lib/samba3/samba3.c | 7 ++-- source4/script/tests/test_s3upgrade.sh | 17 ++++++++++ source4/scripting/libjs/provision.js | 44 ++++++++++++++++++-------- source4/scripting/libjs/upgrade.js | 18 +++++------ source4/setup/provision | 2 +- source4/setup/upgrade | 31 +++++++++++------- swat/install/provision.esp | 2 +- swat/install/samba3.esp | 10 ++++-- 9 files changed, 92 insertions(+), 41 deletions(-) create mode 100755 source4/script/tests/test_s3upgrade.sh diff --git a/source4/lib/samba3/PLAN b/source4/lib/samba3/PLAN index f6cdf1cce40..8c1a6735358 100644 --- a/source4/lib/samba3/PLAN +++ b/source4/lib/samba3/PLAN @@ -1,3 +1,3 @@ TODO (SoC project): - - test ldb_map backend (testsuite?) + - finish ldb_map testsuite - testsuite for the static upgrade diff --git a/source4/lib/samba3/samba3.c b/source4/lib/samba3/samba3.c index 8d5ad771858..b9bb6d73621 100644 --- a/source4/lib/samba3/samba3.c +++ b/source4/lib/samba3/samba3.c @@ -88,9 +88,12 @@ NTSTATUS samba3_read(const char *libdir, const char *smbconf, TALLOC_CTX *ctx, s ret = talloc_zero(ctx, struct samba3); - if (smbconf) { + if (smbconf != NULL) { ret->configuration = param_init(ret); - param_read(ret->configuration, smbconf); + if (param_read(ret->configuration, smbconf) == -1) { + talloc_free(ret); + return NT_STATUS_UNSUCCESSFUL; + } } dbfile = talloc_asprintf(ctx, "%s/account_policy.tdb", libdir); diff --git a/source4/script/tests/test_s3upgrade.sh b/source4/script/tests/test_s3upgrade.sh new file mode 100755 index 00000000000..b0042bed453 --- /dev/null +++ b/source4/script/tests/test_s3upgrade.sh @@ -0,0 +1,17 @@ +#!/bin/sh +PREFIX=$1 + +if [ -z "$PREFIX" ] +then + print "Usage: test_s3upgrade.sh - --ldif Dump LDIF + --targetdir=DIR Output to specified directory --quiet Be quiet --blank do not add users or groups, just the structure @@ -73,11 +66,27 @@ if (samba3 == undefined) { exit(1); } + + message("Provisioning\n"); var subobj = upgrade_provision(samba3); -provision(subobj, message, options.blank); +var paths; +if (options.targetdir != undefined) { + paths = new Object(); + paths.smbconf = sprintf("%s/smb.conf", options.targetdir); + var ldbs = new Array("hklm","hkcr","hku","hkcu","hkpd","hkpt","samdb","rootdse","secrets","winsdb"); + for (var i in ldbs) { + var n = ldbs[i]; + paths[n] = sprintf("tdb://%s/%s.ldb", options.targetdir, n); + } + paths.dns = options.targetdir+"/dns.zone"; +} else { + paths = provision_default_paths(subobj);; +} + +provision(subobj, message, options.blank,paths); -var ret = upgrade(subobj,samba3,message); +var ret = upgrade(subobj,samba3,message,paths); if (ret > 0) { message("Failed to import %d entries\n", ret); } else { diff --git a/swat/install/provision.esp b/swat/install/provision.esp index 714b498b22f..de823ddcde1 100644 --- a/swat/install/provision.esp +++ b/swat/install/provision.esp @@ -59,7 +59,7 @@ if (form['submit'] == "Provision") { write("

You must choose an administrator password. Please try again.

"); f.display(); } else { - provision(subobj, writefln, false); + provision(subobj, writefln, false, provision_default_paths(subobj)); } } else { f.display(); diff --git a/swat/install/samba3.esp b/swat/install/samba3.esp index 729dcc74fdc..5228ca6f863 100644 --- a/swat/install/samba3.esp +++ b/swat/install/samba3.esp @@ -53,8 +53,14 @@ if (form['submit'] == "Import") { for (r in form) { subobj[r] = form[r]; } - provision(subobj, writefln, true); - upgrade(subobj, samba3, writefln); + 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(); } else { var f = FormObj("Import from Samba3", 0, 2); -- 2.34.1