summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-30 12:27:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:35:02 -0500
commit6cf1b0c07c819e9e2afdcb87b2e4fd31ed680b72 (patch)
tree3bd8443bcd179871e6a887f1aafeb6de064816f5
parentb674411eb46c9e45f2740a1f9bac365e9a347e9c (diff)
downloadsamba-6cf1b0c07c819e9e2afdcb87b2e4fd31ed680b72.tar.gz
samba-6cf1b0c07c819e9e2afdcb87b2e4fd31ed680b72.tar.bz2
samba-6cf1b0c07c819e9e2afdcb87b2e4fd31ed680b72.zip
r9793: Be more verbose, check for errors in upgrade script.
(This used to be commit b7c09df9e506f8048f69c4bdd1c3351e3b554e18)
-rw-r--r--source4/dsdb/samdb/ldb_modules/samba3sam.c30
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c3
-rw-r--r--source4/scripting/libjs/upgrade.js32
-rwxr-xr-xsource4/setup/upgrade10
4 files changed, 40 insertions, 35 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c
index 444d7e8d12..02c7281811 100644
--- a/source4/dsdb/samdb/ldb_modules/samba3sam.c
+++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c
@@ -2,24 +2,6 @@
ldb database library - Samba3 SAM compatibility backend
Copyright (C) Jelmer Vernooij 2005
-
- ** NOTE! The following LGPL license applies to the ldb
- ** library. This does NOT imply that all of Samba is released
- ** under the LGPL
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "includes.h"
@@ -67,6 +49,8 @@ static struct ldb_val convert_sid_rid(struct ldb_map_context *map, TALLOC_CTX *c
{
printf("Converting SID TO RID *\n");
+ /* FIXME */
+
return ldb_val_dup(ctx, val);
}
@@ -74,6 +58,8 @@ static struct ldb_val convert_rid_sid(struct ldb_map_context *map, TALLOC_CTX *c
{
printf("Converting RID TO SID *\n");
+ /* FIXME */
+
return ldb_val_dup(ctx, val);
}
@@ -81,6 +67,8 @@ static struct ldb_val convert_unix_id2name(struct ldb_map_context *map, TALLOC_C
{
printf("Converting UNIX ID to name\n");
+ /* FIXME */
+
return ldb_val_dup(ctx, val);
}
@@ -88,6 +76,8 @@ static struct ldb_val convert_unix_name2id(struct ldb_map_context *map, TALLOC_C
{
printf("Converting UNIX name to ID\n");
+ /* FIXME */
+
return ldb_val_dup(ctx, val);
}
@@ -177,10 +167,8 @@ const struct ldb_map_attribute samba3_attributes[] =
/* uid -> unixName */
{
.local_name = "unixName",
- .type = MAP_CONVERT,
+ .type = MAP_RENAME,
.u.convert.remote_name = "uid",
- .u.convert.convert_local = convert_unix_name2id,
- .u.convert.convert_remote = convert_unix_id2name,
},
/* displayName -> name */
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 6b6c8bd55d..3266c89e2d 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -541,7 +541,8 @@ static int samldb_add_record(struct ldb_module *module, const struct ldb_message
ldb_debug(module->ldb, LDB_DEBUG_TRACE, "samldb_add_record\n");
- if (strcmp(msg->dn->components[0].name, "@SPECIAL") == 0) { /* do not manipulate our control entries */
+
+ if (ldb_dn_is_special(msg->dn)) { /* do not manipulate our control entries */
return ldb_next_add_record(module, msg);
}
diff --git a/source4/scripting/libjs/upgrade.js b/source4/scripting/libjs/upgrade.js
index c78afd6a91..c6a65e01c0 100644
--- a/source4/scripting/libjs/upgrade.js
+++ b/source4/scripting/libjs/upgrade.js
@@ -34,8 +34,7 @@ function upgrade_registry(regdb,prefix)
{
assert(regdb != undefined);
var prefix_up = strupper(prefix);
-
- var ldif = "";
+ var ldif = new Array();
for (var i in regdb.keys) {
var rk = regdb.keys[i];
@@ -51,7 +50,7 @@ function upgrade_registry(regdb,prefix)
var pts = split("/", rk.name);
/* Convert key name to dn */
- ldif = ldif + sprintf("
+ ldif[rk.name] = sprintf("
dn: %s
name: %s
@@ -60,7 +59,7 @@ name: %s
for (var j in rk.values) {
var rv = rk.values[j];
- ldif = ldif + sprintf("
+ ldif[rk.name + " (" + rv.name + ")"] = sprintf("
dn: %s,value=%s
value: %s
type: %d
@@ -396,6 +395,7 @@ function save_smbconf(path,smbconf)
function upgrade(subobj, samba3, message)
{
+ var ret = 0;
var samdb = ldb_init();
var ok = samdb.connect("sam.ldb");
assert(ok);
@@ -425,7 +425,10 @@ dn: @MAP=samba3sam
message("... " + samba3.samaccounts[i].username);
var ldif = upgrade_sam_account(samba3.samaccounts[i],subobj.BASEDN);
ok = samdb.add(ldif);
- if (!ok) { message("... error!"); }
+ if (!ok) {
+ message("... error: " + samdb.errstring());
+ ret = ret + 1;
+ }
message("\n");
}
@@ -434,7 +437,10 @@ dn: @MAP=samba3sam
message("... " + samba3.groupmappings[i].nt_name);
var ldif = upgrade_sam_group(samba3.groupmappings[i],subobj.BASEDN);
ok = samdb.add(ldif);
- if (!ok) { message("... error!"); }
+ if (!ok) {
+ message("... error: " + samdb.errstring());
+ ret = ret + 1;
+ }
message("\n");
}
@@ -446,18 +452,26 @@ dn: @MAP=samba3sam
ok = regdb.connect(hives[i] + ".ldb");
assert(ok);
var ldif = upgrade_registry(samba3.registry, hives[i]);
- ok = regdb.add(ldif);
- assert(ok);
+ for (var j in ldif) {
+ message("... ... " + j);
+ ok = regdb.add(ldif[j]);
+ if (!ok) {
+ message("... error: " + regdb.errstring());
+ ret = ret + 1;
+ }
+ message("\n");
+ }
}
message("Importing WINS data\n");
var winsdb = ldb_init();
ok = winsdb.connect("wins.ldb");
assert(ok);
+ ldb_erase(winsdb);
var ldif = upgrade_wins(samba3);
ok = winsdb.add(ldif);
assert(ok);
- return ok;
+ return ret;
}
diff --git a/source4/setup/upgrade b/source4/setup/upgrade
index fed09f2a4e..22090b8cc6 100755
--- a/source4/setup/upgrade
+++ b/source4/setup/upgrade
@@ -81,8 +81,10 @@ message("Provisioning\n");
var subobj = upgrade_provision(samba3);
provision(subobj, message, options.blank);
-ok = upgrade(subobj,samba3,message);
-assert(ok);
-
-message("All OK\n");
+var ret = upgrade(subobj,samba3,message);
+if (ret > 0) {
+ message("Failed to import %d entries\n", ret);
+} else {
+ message("All OK\n");
+}
return 0;