/* the ldb is in bad shape, possibly due to being built from an
incompatible previous version of the code, so delete it
completely */
-function ldb_delete(ldb)
+function ldb_delete(info, ldb)
{
- println("Deleting " + ldb.filename);
+ info.message("Deleting " + ldb.filename + "\n");
var lp = loadparm_init();
sys.unlink(sprintf("%s/%s", lp.get("private dir"), ldb.filename));
ldb.transaction_cancel();
/*
erase an ldb, removing all records
*/
-function ldb_erase(ldb)
+function ldb_erase(info, ldb)
{
var res;
var res = ldb.search("(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs);
var i;
if (res.error != 0) {
- ldb_delete(ldb);
+ ldb_delete(info, ldb);
return;
}
for (i=0;i<res.msgs.length;i++) {
var res = ldb.search("(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs);
if (res.error != 0 || res.msgs.length != 0) {
- ldb_delete(ldb);
+ ldb_delete(info, ldb);
return;
}
assert(res.msgs.length == 0);
ldb.transaction_start();
if (erase) {
- ldb_erase(ldb);
+ ldb_erase(info, ldb);
}
return ldb;
}
var modify_ok = setup_ldb_modify("provision_basedn_modify.ldif", info, samdb);
if (!modify_ok) {
if (!add_ok) {
- message("Failed to both add and modify " + subobj.DOMAINDN + " in target " + subobj.DOMAINDN_LDB + "\n");
+ message("Failed to both add and modify " + subobj.DOMAINDN + " in target " + subobj.DOMAINDN_LDB + ": " + samdb.errstring() + "\n");
message("Perhaps you need to run the provision script with the --ldap-base-dn option, and add this record to the backend manually\n");
};
assert(modify_ok);
var modify_ok = setup_ldb_modify("provision_configuration_basedn_modify.ldif", info, samdb);
if (!modify_ok) {
if (!add_ok) {
- message("Failed to both add and modify the configuration container\n");
+ message("Failed to both add and modify configuration dn: " + samdb.errstring() + "\n");
+ message("Perhaps you need to run the provision script with the --ldap-base-dn option, and add this record to the backend manually\n");
assert(modify_ok);
}
assert(modify_ok);
var modify_ok = setup_ldb_modify("provision_schema_basedn_modify.ldif", info, samdb);
if (!modify_ok) {
if (!add_ok) {
- message("Failed to both add and modify the schema container: " + samdb.errstring() + "\n");
+ message("Failed to both add and modify schema dn: + samdb.errstring() + "\n");
+ message("Perhaps you need to run the provision script with the --ldap-base-dn option, and add this record to the backend manually\n");
assert(modify_ok);
}
message("Failed to modify the schema container: " + samdb.errstring() + "\n");