From d1eac79690d0fe8f8a5a78bcb83a6b4783279e27 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 22 Aug 2012 22:08:36 +1000 Subject: 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 --- source4/dsdb/samdb/ldb_modules/schema_load.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/schema_load.c') diff --git a/source4/dsdb/samdb/ldb_modules/schema_load.c b/source4/dsdb/samdb/ldb_modules/schema_load.c index be7915e03cb..f09c47a3edb 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; } -- cgit v1.2.1