summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema/schema_init.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-11-11 12:12:17 +0100
committerStefan Metzmacher <metze@samba.org>2011-11-15 09:46:30 +0100
commite7e9f1e2dd279beaaf9d94b39378d24548a531cd (patch)
tree60df5df4063dcdca9f803331f29018df6d054129 /source4/dsdb/schema/schema_init.c
parentbe091eddec3715c5807f03fdc3d83ffc5a857433 (diff)
downloadsamba-e7e9f1e2dd279beaaf9d94b39378d24548a531cd.tar.gz
s4:dsdb/schema: add "dsdb:schema update allowed" option to enable schema updates
By default schema updates are not allowed anymore, as we don't have complete validation code to prevent database corruption. metze
Diffstat (limited to 'source4/dsdb/schema/schema_init.c')
-rw-r--r--source4/dsdb/schema/schema_init.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 0a9dedff8ad..a4c29f1aa54 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -818,6 +818,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
const struct ldb_val *info_val;
struct ldb_val info_val_default;
struct dsdb_schema *schema;
+ struct loadparm_context *lp_ctx = NULL;
int ret;
schema = dsdb_new_schema(mem_ctx);
@@ -869,8 +870,20 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
schema->fsmo.we_are_master = false;
}
- DEBUG(5, ("schema_fsmo_init: we are master: %s\n",
- (schema->fsmo.we_are_master?"yes":"no")));
+ lp_ctx = talloc_get_type(ldb_get_opaque(ldb, "loadparm"),
+ struct loadparm_context);
+ if (lp_ctx) {
+ bool allowed = lpcfg_parm_bool(lp_ctx, NULL,
+ "dsdb", "schema update allowed",
+ false);
+ schema->fsmo.update_allowed = allowed;
+ } else {
+ schema->fsmo.update_allowed = false;
+ }
+
+ DEBUG(5, ("schema_fsmo_init: we are master[%s] updates allowed[%s]\n",
+ (schema->fsmo.we_are_master?"yes":"no"),
+ (schema->fsmo.update_allowed?"yes":"no")));
*schema_out = schema;
return LDB_SUCCESS;