From 3e523582ea41702450d2f14535be24ecb45023b7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 18 Jan 2007 01:31:09 +0000 Subject: r20871: implement the validFSMOs constructed attribute on the rootdse for the schema, domain naming and pdc fsmo roles infrastructure and rid manager will be added later, when we have module for them metze (This used to be commit 308f9cf822a3a34dae28a5fa5aa850e2adbeb472) --- source4/dsdb/samdb/ldb_modules/rootdse.c | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'source4/dsdb/samdb/ldb_modules/rootdse.c') diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c index 9a469c4563..a698e0db43 100644 --- a/source4/dsdb/samdb/ldb_modules/rootdse.c +++ b/source4/dsdb/samdb/ldb_modules/rootdse.c @@ -163,6 +163,46 @@ static int rootdse_add_dynamic(struct ldb_module *module, struct ldb_message *ms } } + if (do_attribute_explicit(attrs, "validFSMOs")) { + const struct dsdb_schema_fsmo *schema_fsmo; + const struct dsdb_naming_fsmo *naming_fsmo; + const struct dsdb_pdc_fsmo *pdc_fsmo; + const char *dn_str; + + schema_fsmo = talloc_get_type(ldb_get_opaque(module->ldb, "dsdb_schema_fsmo"), + struct dsdb_schema_fsmo); + if (schema_fsmo && schema_fsmo->we_are_master) { + dn_str = ldb_dn_get_linearized(samdb_schema_dn(module->ldb)); + if (dn_str && dn_str[0]) { + if (ldb_msg_add_fmt(msg, "validFSMOs", "%s", dn_str) != 0) { + goto failed; + } + } + } + + naming_fsmo = talloc_get_type(ldb_get_opaque(module->ldb, "dsdb_naming_fsmo"), + struct dsdb_naming_fsmo); + if (naming_fsmo && naming_fsmo->we_are_master) { + dn_str = ldb_dn_get_linearized(samdb_partitions_dn(module->ldb, msg)); + if (dn_str && dn_str[0]) { + if (ldb_msg_add_fmt(msg, "validFSMOs", "%s", dn_str) != 0) { + goto failed; + } + } + } + + pdc_fsmo = talloc_get_type(ldb_get_opaque(module->ldb, "dsdb_pdc_fsmo"), + struct dsdb_pdc_fsmo); + if (pdc_fsmo && pdc_fsmo->we_are_master) { + dn_str = ldb_dn_get_linearized(samdb_base_dn(module->ldb)); + if (dn_str && dn_str[0]) { + if (ldb_msg_add_fmt(msg, "validFSMOs", "%s", dn_str) != 0) { + goto failed; + } + } + } + } + /* TODO: lots more dynamic attributes should be added here */ return LDB_SUCCESS; -- cgit