1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-26 04:23:49 +03:00

r9842: More error checks in the ldb_map modules, extend testsuite

This commit is contained in:
Jelmer Vernooij
2005-08-31 21:04:17 +00:00
committed by Gerald (Jerry) Carter
parent 2283a336e0
commit b7992de4b7
5 changed files with 161 additions and 83 deletions

View File

@@ -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;
}