summaryrefslogtreecommitdiff
path: root/source4/scripting/libjs
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-31 21:04:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:36:17 -0500
commit222fdd5237c1fd8551c39ce544171df3a5a41831 (patch)
tree062732388f1155cbe911144abe4a503171a6ca97 /source4/scripting/libjs
parent84bfcd3c78afefd8d2869c695c116c9df7ee03c4 (diff)
downloadsamba-222fdd5237c1fd8551c39ce544171df3a5a41831.tar.gz
samba-222fdd5237c1fd8551c39ce544171df3a5a41831.tar.bz2
samba-222fdd5237c1fd8551c39ce544171df3a5a41831.zip
r9842: More error checks in the ldb_map modules, extend testsuite
(This used to be commit b7992de4b7d42a55e00509c887a269a07c19627d)
Diffstat (limited to 'source4/scripting/libjs')
-rw-r--r--source4/scripting/libjs/upgrade.js59
1 files changed, 31 insertions, 28 deletions
diff --git a/source4/scripting/libjs/upgrade.js b/source4/scripting/libjs/upgrade.js
index 59e433b0f2..ac7e445330 100644
--- a/source4/scripting/libjs/upgrade.js
+++ b/source4/scripting/libjs/upgrade.js
@@ -418,34 +418,6 @@ function upgrade(subobj, samba3, message, paths)
ok = samdb.modify(ldif);
assert(ok);
- // figure out ldapurl, if applicable
- var ldapurl = undefined;
- var pdb = samba3.configuration.get_list("passdb backend");
- if (pdb != undefined) {
- for (var b in pdb) {
- if (substr(pdb[b], 0, 7) == "ldapsam") {
- ldapurl = substr(pdb[b], 8);
- }
- }
- }
-
- // URL was not specified in passdb backend but ldap /is/ used
- if (ldapurl == "") {
- ldapurl = "ldap://" + samba3.configuration.get("ldap server");
- }
-
- // Enable samba3sam module if original passdb backend was ldap
- if (ldapurl != undefined) {
- message("Enabling Samba3 LDAP mappings for SAM database\n");
- var ldif = sprintf("
-dn: @MAP=samba3sam
-@MAP_URL: %s", ldapurl);
- samdb.add(ldif);
-
- samdb.modify("dn: @MODULES
-@LIST: samldb,timestamps,objectguid,rdn_name,samba3sam");
- }
-
message("Importing users\n");
for (var i in samba3.samaccounts) {
var msg = "... " + samba3.samaccounts[i].username;
@@ -500,6 +472,37 @@ dn: @MAP=samba3sam
ok = winsdb.add(ldif);
assert(ok);
+ // figure out ldapurl, if applicable
+ var ldapurl = undefined;
+ var pdb = samba3.configuration.get_list("passdb backend");
+ if (pdb != undefined) {
+ for (var b in pdb) {
+ if (substr(pdb[b], 0, 7) == "ldapsam") {
+ ldapurl = substr(pdb[b], 8);
+ }
+ }
+ }
+
+ // URL was not specified in passdb backend but ldap /is/ used
+ if (ldapurl == "") {
+ ldapurl = "ldap://" + samba3.configuration.get("ldap server");
+ }
+
+ // Enable samba3sam module if original passdb backend was ldap
+ if (ldapurl != undefined) {
+ message("Enabling Samba3 LDAP mappings for SAM database\n");
+ var ldif = sprintf("
+dn: @MAP=samba3sam
+@MAP_URL: %s", ldapurl);
+ ok = samdb.add(ldif);
+ assert(ok);
+
+ ok = samdb.modify("dn: @MODULES
+replace: @LIST
+@LIST: samldb,timestamps,objectguid,rdn_name,samba3sam");
+ assert(ok);
+ }
+
return ret;
}