summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/partition_init.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-11-23 20:30:35 +1100
committerStefan Metzmacher <metze@samba.org>2009-11-23 14:15:07 +0100
commit401ba9c9cf357d6b420a7401fc1a915871d96f8d (patch)
tree0bf733a327ce712e4d815b0a62e3f2278780a4ae /source4/dsdb/samdb/ldb_modules/partition_init.c
parente297af00fad2032e79f1889fd6d2713932249bb0 (diff)
downloadsamba-401ba9c9cf357d6b420a7401fc1a915871d96f8d.tar.gz
samba-401ba9c9cf357d6b420a7401fc1a915871d96f8d.tar.bz2
samba-401ba9c9cf357d6b420a7401fc1a915871d96f8d.zip
s4:dsdb Move module configuration from each ldb into samba_dsdb.c
This makes getting the module order correct, the obligation of Samba4 developers, and not system administrators. In particular, once an ldb is updated to use only the 'samba_dsdb' module, no further changes to the ldb should be required when upgrading to later Samba4 versions. (thanks to metze for the suggestion of samba_dsdb as a long-term stable name for the module) Andrew Bartlett
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/partition_init.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition_init.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c b/source4/dsdb/samdb/ldb_modules/partition_init.c
index 416648c0ac..c791c6f6cf 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_init.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_init.c
@@ -129,7 +129,7 @@ static int partition_load_modules(struct ldb_context *ldb,
static int partition_reload_metadata(struct ldb_module *module, struct partition_private_data *data, TALLOC_CTX *mem_ctx, struct ldb_message **_msg)
{
int ret;
- struct ldb_message *msg;
+ struct ldb_message *msg, *module_msg;
struct ldb_result *res;
struct ldb_context *ldb = ldb_module_get_ctx(module);
const char *attrs[] = { "partition", "replicateEntries", "modules", "ldapBackend", NULL };
@@ -148,7 +148,16 @@ static int partition_reload_metadata(struct ldb_module *module, struct partition
return ret;
}
- ret = partition_load_modules(ldb, data, msg);
+ /* When used from Samba4, this message is set by the samba4
+ * module, as a fixed value not read from the DB. This avoids
+ * listing modules in the DB */
+ if (data->forced_module_msg) {
+ module_msg = data->forced_module_msg;
+ } else {
+ module_msg = msg;
+ }
+
+ ret = partition_load_modules(ldb, data, module_msg);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -790,7 +799,7 @@ int partition_init(struct ldb_module *module)
{
int ret;
TALLOC_CTX *mem_ctx = talloc_new(module);
-
+ struct ldb_context *ldb = ldb_module_get_ctx(module);
struct partition_private_data *data;
if (!mem_ctx) {
@@ -802,6 +811,14 @@ int partition_init(struct ldb_module *module)
return LDB_ERR_OPERATIONS_ERROR;
}
+ /* When used from Samba4, this message is set by the samba4
+ * module, as a fixed value not read from the DB. This avoids
+ * listing modules in the DB */
+ data->forced_module_msg = talloc_get_type(
+ ldb_get_opaque(ldb,
+ DSDB_OPAQUE_PARTITION_MODULE_MSG_OPAQUE_NAME),
+ struct ldb_message);
+
/* This loads the partitions */
ret = partition_reload_if_required(module, data);
if (ret != LDB_SUCCESS) {
@@ -813,14 +830,14 @@ int partition_init(struct ldb_module *module)
ret = ldb_mod_register_control(module, LDB_CONTROL_DOMAIN_SCOPE_OID);
if (ret != LDB_SUCCESS) {
- ldb_debug(ldb_module_get_ctx(module), LDB_DEBUG_ERROR,
+ ldb_debug(ldb, LDB_DEBUG_ERROR,
"partition: Unable to register control with rootdse!\n");
return LDB_ERR_OPERATIONS_ERROR;
}
ret = ldb_mod_register_control(module, LDB_CONTROL_SEARCH_OPTIONS_OID);
if (ret != LDB_SUCCESS) {
- ldb_debug(ldb_module_get_ctx(module), LDB_DEBUG_ERROR,
+ ldb_debug(ldb, LDB_DEBUG_ERROR,
"partition: Unable to register control with rootdse!\n");
return LDB_ERR_OPERATIONS_ERROR;
}