summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-14 19:08:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:40:53 -0500
commitb15f4878e194bc47ec08ab54e74ebeb5fa9aae6c (patch)
treec38216ebec2bbc3c04e131e03b73a354adfbbbec /source4/dsdb/samdb
parent3b956f0779a5b6994020d716ba042f3ace0d4a8a (diff)
downloadsamba-b15f4878e194bc47ec08ab54e74ebeb5fa9aae6c.tar.gz
samba-b15f4878e194bc47ec08ab54e74ebeb5fa9aae6c.tar.bz2
samba-b15f4878e194bc47ec08ab54e74ebeb5fa9aae6c.zip
r20780: keep a dsdb_schema_fsmo struct as private data
and remember if we're the schema master metze (This used to be commit c42dab21fb275ca36a517f97922af21447671785)
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema_fsmo.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
index 9faed9a5ac..33a7539b39 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
@@ -32,13 +32,19 @@
#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "lib/util/dlinklist.h"
+struct dsdb_schema_fsmo {
+ bool we_are_master;
+};
+
static int schema_fsmo_init(struct ldb_module *module)
{
WERROR status;
TALLOC_CTX *mem_ctx;
struct ldb_dn *schema_dn;
struct dsdb_schema *schema;
+ struct dsdb_schema_fsmo *schema_fsmo;
struct ldb_result *schema_res;
+ struct ldb_dn *schema_master_dn;
const struct ldb_val *prefix_val;
const struct ldb_val *info_val;
struct ldb_result *a_res;
@@ -48,6 +54,7 @@ static int schema_fsmo_init(struct ldb_module *module)
static const char *schema_attrs[] = {
"prefixMap",
"schemaInfo",
+ "fSMORoleOwner",
NULL
};
@@ -64,6 +71,13 @@ 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;
+ }
+ module->private_data = schema_fsmo;
+
schema = talloc_zero(mem_ctx, struct dsdb_schema);
if (!schema) {
ldb_oom(module->ldb);
@@ -210,6 +224,13 @@ static int schema_fsmo_init(struct ldb_module *module)
return ret;
}
+ schema_master_dn = ldb_msg_find_attr_as_dn(module->ldb, mem_ctx, schema_res->msgs[0], "fSMORoleOwner");
+ if (ldb_dn_compare(samdb_ntds_settings_dn(module->ldb), schema_master_dn) == 0) {
+ schema_fsmo->we_are_master = true;
+ } else {
+ schema_fsmo->we_are_master = false;
+ }
+
talloc_free(mem_ctx);
return ldb_next_init(module);
}