From 326aac06f52a1e4d37449622e02d561ee12608cf Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 3 Jul 2010 14:33:23 +0200 Subject: s4:schema_load LDB module - fix a segfault condition on schema refresh The schema refresh operation itself starts requests from the top of the LDB modules stack (see call "dsdb_schema_set_attributes" - search operations). This doesn't work well when these do perform "dsdb_get_schema" calls. Since the new schema isn't marked as "refreshed" atm (but in fact it still is - we didn't terminate the reload/refresh yet) we could perform other calls to "dsdb_schema_refresh" and run into serious trouble (segfault). --- source4/dsdb/samdb/ldb_modules/schema_load.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source4/dsdb/samdb/ldb_modules/schema_load.c b/source4/dsdb/samdb/ldb_modules/schema_load.c index 9d9c9ebcd7..30aafdb65e 100644 --- a/source4/dsdb/samdb/ldb_modules/schema_load.c +++ b/source4/dsdb/samdb/ldb_modules/schema_load.c @@ -224,6 +224,7 @@ static int dsdb_schema_from_db(struct ldb_module *module, struct ldb_dn *schema_ goto failed; } + (*schema)->refresh_in_progress = true; (*schema)->refresh_fn = dsdb_schema_refresh; (*schema)->loaded_from_module = module; (*schema)->loaded_usn = current_usn; @@ -231,6 +232,10 @@ static int dsdb_schema_from_db(struct ldb_module *module, struct ldb_dn *schema_ /* "dsdb_set_schema()" steals schema into the ldb_context */ ret = dsdb_set_schema(ldb, (*schema)); + if (*schema != NULL) { + (*schema)->refresh_in_progress = false; + } + if (ret != LDB_SUCCESS) { ldb_debug_set(ldb, LDB_DEBUG_FATAL, "schema_load_init: dsdb_set_schema() failed: %d:%s: %s", -- cgit