summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/naming_fsmo.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-18 01:31:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:43:43 -0500
commit3e523582ea41702450d2f14535be24ecb45023b7 (patch)
treeae3bc31a44ff4e27dcf0df7f229fc9ae560cb53d /source4/dsdb/samdb/ldb_modules/naming_fsmo.c
parent301129f6defacfc924647e6aa7be45cf6d7f2f5b (diff)
downloadsamba-3e523582ea41702450d2f14535be24ecb45023b7.tar.gz
samba-3e523582ea41702450d2f14535be24ecb45023b7.tar.bz2
samba-3e523582ea41702450d2f14535be24ecb45023b7.zip
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)
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/naming_fsmo.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/naming_fsmo.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/naming_fsmo.c b/source4/dsdb/samdb/ldb_modules/naming_fsmo.c
index 9041c37ce7..ddd120caf2 100644
--- a/source4/dsdb/samdb/ldb_modules/naming_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/naming_fsmo.c
@@ -32,17 +32,12 @@
#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "lib/util/dlinklist.h"
-struct dsdb_naming_fsmo {
- bool we_are_master;
-};
-
static int naming_fsmo_init(struct ldb_module *module)
{
TALLOC_CTX *mem_ctx;
struct ldb_dn *naming_dn;
struct dsdb_naming_fsmo *naming_fsmo;
struct ldb_result *naming_res;
- struct ldb_dn *naming_master_dn;
int ret;
static const char *naming_attrs[] = {
"fSMORoleOwner",
@@ -95,13 +90,20 @@ static int naming_fsmo_init(struct ldb_module *module)
return LDB_ERR_CONSTRAINT_VIOLATION;
}
- naming_master_dn = ldb_msg_find_attr_as_dn(module->ldb, mem_ctx, naming_res->msgs[0], "fSMORoleOwner");
- if (ldb_dn_compare(samdb_ntds_settings_dn(module->ldb), naming_master_dn) == 0) {
+ naming_fsmo->master_dn = ldb_msg_find_attr_as_dn(module->ldb, naming_fsmo, naming_res->msgs[0], "fSMORoleOwner");
+ if (ldb_dn_compare(samdb_ntds_settings_dn(module->ldb), naming_fsmo->master_dn) == 0) {
naming_fsmo->we_are_master = true;
} else {
naming_fsmo->we_are_master = false;
}
+ if (ldb_set_opaque(module->ldb, "dsdb_naming_fsmo", naming_fsmo) != LDB_SUCCESS) {
+ ldb_oom(module->ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ talloc_steal(module, naming_fsmo);
+
ldb_debug(module->ldb, LDB_DEBUG_TRACE,
"naming_fsmo_init: we are master: %s\n",
(naming_fsmo->we_are_master?"yes":"no"));