What we really should do is have the refresh function and module be on a seperate object to the schema, only referring to the data and not excuting on the original ldb and event loop.
Andrew Bartlett
Change-Id: I9e4c12639856bd9ac57f5feb0be8d47377443c1f
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
return LDB_SUCCESS;
}
-static struct dsdb_schema *dsdb_schema_refresh(struct ldb_module *module, struct dsdb_schema *schema, bool is_global_schema)
+static struct dsdb_schema *dsdb_schema_refresh(struct ldb_module *module, struct tevent_context *ev,
+ struct dsdb_schema *schema, bool is_global_schema)
{
uint64_t current_usn, value;
int ret;
return schema;
}
+ if (ev != ldb_get_event_context(ldb)) {
+ /* We do NOT want to execute an operation on another event context */
+ return schema;
+ }
+
lastts = schema->last_refresh;
ts = time(NULL);
if (lastts > (ts - schema->refresh_interval)) {
/* Was this schema loaded from ldb (if so, then we will reload it when we detect a change in ldb) */
struct ldb_module *loaded_from_module;
- struct dsdb_schema *(*refresh_fn)(struct ldb_module *module, struct dsdb_schema *schema, bool is_global_schema);
+ struct dsdb_schema *(*refresh_fn)(struct ldb_module *module,
+ struct tevent_context *ev,
+ struct dsdb_schema *schema, bool is_global_schema);
bool refresh_in_progress;
time_t ts_last_change;
time_t last_refresh;
schema_in->refresh_in_progress = true;
/* This may change schema, if it needs to reload it from disk */
schema_out = schema_in->refresh_fn(schema_in->loaded_from_module,
+ ldb_get_event_context(ldb),
schema_in,
use_global_schema);
schema_in->refresh_in_progress = false;