summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/schema_load.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-08-22 22:08:36 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-08-23 15:02:25 +0200
commitd1eac79690d0fe8f8a5a78bcb83a6b4783279e27 (patch)
treee330820d20cb00bc4035cbb30e1ad32ba5344f85 /source4/dsdb/samdb/ldb_modules/schema_load.c
parenta58ac39a5ae97b3aebfde10466798b41baccaacf (diff)
downloadsamba-d1eac79690d0fe8f8a5a78bcb83a6b4783279e27.tar.gz
samba-d1eac79690d0fe8f8a5a78bcb83a6b4783279e27.tar.bz2
samba-d1eac79690d0fe8f8a5a78bcb83a6b4783279e27.zip
s4-dsdb: Do not use a possibly-old loadparm context in schema reload
The loadparm context on the schema DB might have gone away already. Pre-cache the schema refresh interval at load time to avoid worrying about this. Andrew Bartlett
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/schema_load.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema_load.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/schema_load.c b/source4/dsdb/samdb/ldb_modules/schema_load.c
index be7915e03c..f09c47a3ed 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_load.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_load.c
@@ -166,10 +166,7 @@ static struct dsdb_schema *dsdb_schema_refresh(struct ldb_module *module, struct
struct dsdb_control_current_partition *ctrl;
struct ldb_context *ldb = ldb_module_get_ctx(module);
struct dsdb_schema *new_schema;
- int interval;
- time_t ts, lastts;
- struct loadparm_context *lp_ctx =
- (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm");
+ time_t ts, lastts;
struct schema_load_private_data *private_data = talloc_get_type(ldb_module_get_private(module), struct schema_load_private_data);
if (!private_data) {
@@ -184,9 +181,8 @@ static struct dsdb_schema *dsdb_schema_refresh(struct ldb_module *module, struct
lastts = schema->last_refresh;
ts = time(NULL);
- interval = lpcfg_parm_int(lp_ctx, NULL, "dsdb", "schema_reload_interval", 120);
- if (lastts > (ts - interval)) {
- DEBUG(11, ("Less than %d seconds since last reload, returning cached version ts = %d\n", interval, (int)lastts));
+ if (lastts > (ts - schema->refresh_interval)) {
+ DEBUG(11, ("Less than %d seconds since last reload, returning cached version ts = %d\n", (int)schema->refresh_interval, (int)lastts));
return schema;
}