summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/pdc_fsmo.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/pdc_fsmo.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c b/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
index 16b40ef8d9..35a1636a4d 100644
--- a/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/pdc_fsmo.c
@@ -31,17 +31,12 @@
#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "lib/util/dlinklist.h"
-struct dsdb_pdc_fsmo {
- bool we_are_master;
-};
-
static int pdc_fsmo_init(struct ldb_module *module)
{
TALLOC_CTX *mem_ctx;
struct ldb_dn *pdc_dn;
struct dsdb_pdc_fsmo *pdc_fsmo;
struct ldb_result *pdc_res;
- struct ldb_dn *pdc_master_dn;
int ret;
static const char *pdc_attrs[] = {
"fSMORoleOwner",
@@ -94,13 +89,20 @@ static int pdc_fsmo_init(struct ldb_module *module)
return LDB_ERR_CONSTRAINT_VIOLATION;
}
- pdc_master_dn = ldb_msg_find_attr_as_dn(module->ldb, mem_ctx, pdc_res->msgs[0], "fSMORoleOwner");
- if (ldb_dn_compare(samdb_ntds_settings_dn(module->ldb), pdc_master_dn) == 0) {
+ pdc_fsmo->master_dn = ldb_msg_find_attr_as_dn(module->ldb, mem_ctx, pdc_res->msgs[0], "fSMORoleOwner");
+ if (ldb_dn_compare(samdb_ntds_settings_dn(module->ldb), pdc_fsmo->master_dn) == 0) {
pdc_fsmo->we_are_master = true;
} else {
pdc_fsmo->we_are_master = false;
}
+ if (ldb_set_opaque(module->ldb, "dsdb_pdc_fsmo", pdc_fsmo) != LDB_SUCCESS) {
+ ldb_oom(module->ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ talloc_steal(module, pdc_fsmo);
+
ldb_debug(module->ldb, LDB_DEBUG_TRACE,
"pdc_fsmo_init: we are master: %s\n",
(pdc_fsmo->we_are_master?"yes":"no"));