r19334: Commit commented provisioning code to activate the schema
authorSimo Sorce <idra@samba.org>
Mon, 16 Oct 2006 12:05:44 +0000 (12:05 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:21:11 +0000 (14:21 -0500)
(This used to be commit 57ee79c15579d1bbe7c0d3202b84a06b75320e40)

source4/scripting/libjs/provision.js

index 05e67262445fbb427a3a68903783ae0e617db0f7..2eac2b731cf326384b67738d11b9bbf0f9e5ec4a 100644 (file)
@@ -282,6 +282,25 @@ function setup_add_ldif(ldif, info, ldb, failok)
        return add_ok;
 }
 
+function setup_modify_ldif(ldif, info, ldb, failok)
+{
+       var lp = loadparm_init();
+       var src = lp.get("setup directory") + "/" + ldif;
+
+       var data = sys.file_load(src);
+       data = substitute_var(data, info.subobj);
+
+       var mod_ok = ldb.modify(data);
+       if (!mod_ok) {
+               info.message("ldb load failed: " + ldb.errstring() + "\n");
+               if (!failok) {
+                       assert(mod_ok);
+               }
+       }
+       return mod_ok;
+}
+
+
 function setup_ldb(ldif, info, dbname) 
 {
        var erase = true;
@@ -524,6 +543,19 @@ function provision(subobj, message, blank, paths, session_info, credentials)
                return true;
        }
 
+//     message("Activate schema module");
+//     setup_modify_ldif("schema_activation.ldif", info, samdb, false);
+//
+//     // (hack) Reload, now we have the schema loaded.  
+//     var commit_ok = samdb.transaction_commit();
+//     if (!commit_ok) {
+//             info.message("samdb commit failed: " + samdb.errstring() + "\n");
+//             assert(commit_ok);
+//     }
+//     samdb.close();
+//
+//     samdb = open_ldb(info, paths.samdb, false);
+//
        message("Setting up sam.ldb users and groups\n");
        setup_add_ldif("provision_users.ldif", info, samdb, false);