From 3d4c4c5fa3596646e98fa50f8f735ffc1cbe8240 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 23 Apr 2007 07:33:15 +0000 Subject: r22478: Update the LDAP backend code to handle initialisation of multiple partitions onto the target LDAP server. Make the LDAP provision run before smbd starts, then stop the LDAP server. This ensures this occurs synchronously, We then restart it for the 'real run' (with slapd's stdin being the FIFO). This required fixing a few things in the provision scripts, with more containers being created via a add/modify pair. Andrew Bartlett (This used to be commit 860dfa4ea1ab2b62d4d4fe0644e0a9b882fdafa1) --- source4/scripting/libjs/provision.js | 42 +++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'source4/scripting') diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js index 9340d43ed9..6af753e7eb 100644 --- a/source4/scripting/libjs/provision.js +++ b/source4/scripting/libjs/provision.js @@ -386,6 +386,8 @@ function provision_default_paths(subobj) paths.dns = lp.get("private dir") + "/" + subobj.DNSDOMAIN + ".zone"; paths.winsdb = "wins.ldb"; paths.ldap_basedn_ldif = lp.get("private dir") + "/" + subobj.DNSDOMAIN + ".ldif"; + paths.ldap_config_basedn_ldif = lp.get("private dir") + "/" + subobj.DNSDOMAIN + "-config.ldif"; + paths.ldap_schema_basedn_ldif = lp.get("private dir") + "/" + subobj.DNSDOMAIN + "-schema.ldif"; return paths; } @@ -573,6 +575,31 @@ function provision(subobj, message, blank, paths, session_info, credentials, lda assert(modify_ok); }; + message("Adding configuration container (permitted to fail)\n"); + var add_ok = setup_add_ldif("provision_configuration_basedn.ldif", info, samdb, true); + message("Modifying configuration container\n"); + 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"); + assert(modify_ok); + } + assert(modify_ok); + } + + message("Adding schema container (permitted to fail)\n"); + var add_ok = setup_add_ldif("provision_schema_basedn.ldif", info, samdb, true); + message("Modifying schema container\n"); + 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"); + assert(modify_ok); + } + message("Failed to modify the schema container: " + samdb.errstring() + "\n"); + assert(modify_ok); + } + message("Setting up sam.ldb Samba4 schema\n"); setup_add_ldif("schema_samba4.ldif", info, samdb, false); message("Setting up sam.ldb AD schema\n"); @@ -588,6 +615,9 @@ function provision(subobj, message, blank, paths, session_info, credentials, lda samdb = open_ldb(info, paths.samdb, false); + message("Setting up sam.ldb configuration data\n"); + setup_add_ldif("provision_configuration.ldif", info, samdb, false); + message("Setting up display specifiers\n"); setup_add_ldif("display_specifiers.ldif", info, samdb, false); message("Setting up sam.ldb templates\n"); @@ -618,8 +648,6 @@ function provision(subobj, message, blank, paths, session_info, credentials, lda message("Setting up sam.ldb data\n"); setup_add_ldif("provision.ldif", info, samdb, false); - message("Setting up sam.ldb configuration data\n"); - setup_add_ldif("provision_configuration.ldif", info, samdb, false); if (blank != false) { message("Setting up sam.ldb index\n"); @@ -716,7 +744,15 @@ function provision_ldapbase(subobj, message, paths) message, paths.ldap_basedn_ldif, subobj); - message("Please install the LDIF located in " + paths.ldap_basedn_ldif + " into your LDAP server, and re-run with --ldap-backend=ldap://my.ldap.server\n"); + setup_file("provision_configuration_basedn.ldif", + message, paths.ldap_config_basedn_ldif, + subobj); + + setup_file("provision_schema_basedn.ldif", + message, paths.ldap_schema_basedn_ldif, + subobj); + + message("Please install the LDIF located in " + paths.ldap_basedn_ldif + ", " + paths.ldap_config_basedn_ldif + " and " + paths.ldap_schema_basedn_ldif + " into your LDAP server, and re-run with --ldap-backend=ldap://my.ldap.server\n"); } -- cgit