Make the repl_meta_data module the default for domain controllers.
[samba.git] / source4 / scripting / libjs / provision.js
index b782d948be2e4607968f99bbb2f9f24c90a5eede..4cb717bde876bb99c9a7d79d7c66b1e8f9747133 100644 (file)
@@ -610,10 +610,21 @@ function provision(subobj, message, blank, paths, session_info, credentials, lda
        var lp = loadparm_init();
        var sys = sys_init();
        var info = new Object();
+       random_init(local);
 
        var ok = provision_fix_subobj(subobj, paths);
        assert(ok);
 
+       if (strlower(subobj.SERVERROLE) == strlower("domain controller")) {
+               if (subobj.BACKEND_MOD == undefined) {
+                       subobj.BACKEND_MOD = "repl_meta_data";
+               }
+       } else {
+               if (subobj.BACKEND_MOD == undefined) {
+                       subobj.BACKEND_MOD = "objectguid";
+               }
+       }
+
        if (subobj.DOMAINGUID != undefined) {
                subobj.DOMAINGUID_MOD = sprintf("replace: objectGUID\nobjectGUID: %s\n-", subobj.DOMAINGUID);
        } else {
@@ -693,7 +704,19 @@ function provision(subobj, message, blank, paths, session_info, credentials, lda
 
        samdb.set_domain_sid(subobj.DOMAINSID);
 
-       samdb.set_ntds_invocationId(subobj.INVOCATIONID);
+       if (strlower(subobj.SERVERROLE) == strlower("domain controller")) {
+               if (subobj.INVOCATIONID == undefined) {
+                       subobj.INVOCATIONID = randguid();
+               }
+               samdb.set_ntds_invocationId(subobj.INVOCATIONID);
+               if (subobj.BACKEND_MOD == undefined) {
+                       subobj.BACKEND_MOD = "repl_meta_data";
+               }
+       } else {
+               if (subobj.BACKEND_MOD == undefined) {
+                       subobj.BACKEND_MOD = "objectguid";
+               }
+       }
 
        var load_schema_ok = load_schema(subobj, message, samdb);
        assert(load_schema_ok.is_ok);
@@ -960,7 +983,6 @@ function provision_guess()
        subobj.VERSION      = version();
        subobj.HOSTIP       = hostip();
        subobj.DOMAINSID    = randsid();
-       subobj.INVOCATIONID = randguid();
        subobj.POLICYGUID   = randguid();
        subobj.KRBTGTPASS   = randpass(12);
        subobj.MACHINEPASS  = randpass(12);
@@ -1012,9 +1034,6 @@ function provision_guess()
        subobj.DOMAINDN_MOD = "pdc_fsmo,password_hash,instancetype";
        subobj.CONFIGDN_MOD = "naming_fsmo,instancetype";
        subobj.SCHEMADN_MOD = "schema_fsmo,instancetype";
-       subobj.DOMAINDN_MOD2 = ",repl_meta_data";
-       subobj.CONFIGDN_MOD2 = ",repl_meta_data";
-       subobj.SCHEMADN_MOD2 = ",repl_meta_data";
 
        subobj.ACI              = "# no aci for local ldb";