From db0a105aae2ba32be4aa5658fc8963ba28933a6b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 1 Jul 2008 16:35:13 +0200 Subject: schema_fsmo: move fsmo info into struct dsdb_schema metze (This used to be commit 8538d305c803268c712a90879f29a2a74ba0ef03) --- source4/dsdb/samdb/ldb_modules/schema_fsmo.c | 32 +++++++--------------------- 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules/schema_fsmo.c') diff --git a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c index bc1e60abb2..0fcda0a430 100644 --- a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c +++ b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c @@ -38,7 +38,6 @@ static int schema_fsmo_init(struct ldb_module *module) TALLOC_CTX *mem_ctx; struct ldb_dn *schema_dn; struct dsdb_schema *schema; - struct dsdb_schema_fsmo *schema_fsmo; struct ldb_result *schema_res; const struct ldb_val *prefix_val; const struct ldb_val *info_val; @@ -54,8 +53,6 @@ static int schema_fsmo_init(struct ldb_module *module) NULL }; - module->private_data = NULL; - if (dsdb_get_schema(module->ldb)) { return ldb_next_init(module); } @@ -74,12 +71,6 @@ static int schema_fsmo_init(struct ldb_module *module) return LDB_ERR_OPERATIONS_ERROR; } - schema_fsmo = talloc_zero(mem_ctx, struct dsdb_schema_fsmo); - if (!schema_fsmo) { - ldb_oom(module->ldb); - return LDB_ERR_OPERATIONS_ERROR; - } - schema = dsdb_new_schema(mem_ctx, lp_iconv_convenience(ldb_get_opaque(module->ldb, "loadparm"))); if (!schema) { ldb_oom(module->ldb); @@ -225,6 +216,13 @@ static int schema_fsmo_init(struct ldb_module *module) } talloc_free(c_res); + schema->fsmo.master_dn = ldb_msg_find_attr_as_dn(module->ldb, schema, schema_res->msgs[0], "fSMORoleOwner"); + if (ldb_dn_compare(samdb_ntds_settings_dn(module->ldb), schema->fsmo.master_dn) == 0) { + schema->fsmo.we_are_master = true; + } else { + schema->fsmo.we_are_master = false; + } + /* dsdb_set_schema() steal schema into the ldb_context */ ret = dsdb_set_schema(module->ldb, schema); if (ret != LDB_SUCCESS) { @@ -235,23 +233,9 @@ static int schema_fsmo_init(struct ldb_module *module) return ret; } - schema_fsmo->master_dn = ldb_msg_find_attr_as_dn(module->ldb, schema_fsmo, schema_res->msgs[0], "fSMORoleOwner"); - if (ldb_dn_compare(samdb_ntds_settings_dn(module->ldb), schema_fsmo->master_dn) == 0) { - schema_fsmo->we_are_master = true; - } else { - schema_fsmo->we_are_master = false; - } - - if (ldb_set_opaque(module->ldb, "dsdb_schema_fsmo", schema_fsmo) != LDB_SUCCESS) { - ldb_oom(module->ldb); - return LDB_ERR_OPERATIONS_ERROR; - } - - module->private_data = talloc_steal(module, schema_fsmo); - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "schema_fsmo_init: we are master: %s\n", - (schema_fsmo->we_are_master?"yes":"no")); + (schema->fsmo.we_are_master?"yes":"no")); talloc_free(mem_ctx); return ldb_next_init(module); -- cgit