summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-03-16 14:40:15 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-03-16 19:25:14 +1100
commitc874b9f42eebacd9ad6baa90309635db8b8ec3fb (patch)
treeb49d802b3e9c76faaacad4bd62455a6e5d793730 /source4/dsdb/samdb
parent19aa07564228f8018d5c7f3bdfcd3d7c311f08b1 (diff)
downloadsamba-c874b9f42eebacd9ad6baa90309635db8b8ec3fb.tar.gz
samba-c874b9f42eebacd9ad6baa90309635db8b8ec3fb.tar.bz2
samba-c874b9f42eebacd9ad6baa90309635db8b8ec3fb.zip
s4:dsdb Don't error out if we can't get the Aggregate schema DN yet
It's easier to just set it up when we can, then to deal with the ordering issues in ldb startup. As long as we have it ready if a real client ever asks for it, then we should be happy. Andrew Bartlett
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/operational.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/operational.c b/source4/dsdb/samdb/ldb_modules/operational.c
index 1d0269854f..9fc0d1aeae 100644
--- a/source4/dsdb/samdb/ldb_modules/operational.c
+++ b/source4/dsdb/samdb/ldb_modules/operational.c
@@ -265,7 +265,21 @@ static int construct_subschema_subentry(struct ldb_module *module,
{
struct operational_data *data = talloc_get_type(ldb_module_get_private(module), struct operational_data);
char *subSchemaSubEntry;
- if (data && data->aggregate_dn) {
+
+ /* We may be being called before the init function has finished */
+ if (!data) {
+ return LDB_SUCCESS;
+ }
+
+ /* Try and set this value up, if possible. Don't worry if it
+ * fails, we may not have the DB set up yet, and it's not
+ * really vital anyway */
+ if (!data->aggregate_dn) {
+ struct ldb_context *ldb = ldb_module_get_ctx(module);
+ data->aggregate_dn = samdb_aggregate_schema_dn(ldb, data);
+ }
+
+ if (data->aggregate_dn) {
subSchemaSubEntry = ldb_dn_alloc_linearized(msg, data->aggregate_dn);
return ldb_msg_add_steal_string(msg, "subSchemaSubEntry", subSchemaSubEntry);
}
@@ -563,25 +577,18 @@ static int operational_search(struct ldb_module *module, struct ldb_request *req
static int operational_init(struct ldb_module *ctx)
{
struct operational_data *data;
- struct ldb_context *ldb = ldb_module_get_ctx(ctx);
int ret = ldb_next_init(ctx);
if (ret != LDB_SUCCESS) {
return ret;
}
- data = talloc(ctx, struct operational_data);
+ data = talloc_zero(ctx, struct operational_data);
if (!data) {
ldb_module_oom(ctx);
return LDB_ERR_OPERATIONS_ERROR;
}
- data->aggregate_dn = samdb_aggregate_schema_dn(ldb, data);
- if (!data->aggregate_dn) {
- ldb_set_errstring(ldb, "Could not build aggregate schema DN");
- return LDB_ERR_OPERATIONS_ERROR;
- }
-
ldb_module_set_private(ctx, data);
return LDB_SUCCESS;