summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema
diff options
context:
space:
mode:
Diffstat (limited to 'source4/dsdb/schema')
-rw-r--r--source4/dsdb/schema/schema_info_attr.c7
-rw-r--r--source4/dsdb/schema/schema_init.c2
-rw-r--r--source4/dsdb/schema/schema_set.c2
3 files changed, 8 insertions, 3 deletions
diff --git a/source4/dsdb/schema/schema_info_attr.c b/source4/dsdb/schema/schema_info_attr.c
index 2d3dfc827c..21ffb1d79f 100644
--- a/source4/dsdb/schema/schema_info_attr.c
+++ b/source4/dsdb/schema/schema_info_attr.c
@@ -297,14 +297,19 @@ static WERROR dsdb_module_schema_info_write(struct ldb_module *ldb_module,
/**
* Creates new dsdb_schema_info object using
* invocationId from supplied ldb
+ * @param check_invocation_id Error out if invocationId is not yet set
*/
-WERROR dsdb_schema_info_create(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, struct dsdb_schema_info **_schema_info)
+WERROR dsdb_schema_info_create(struct ldb_context *ldb, bool check_invocation_id,
+ TALLOC_CTX *mem_ctx, struct dsdb_schema_info **_schema_info)
{
const struct GUID *invocation_id;
struct dsdb_schema_info *schema_info;
/* try to determine invocationId from ldb */
invocation_id = samdb_ntds_invocation_id(ldb);
+ if (check_invocation_id && !invocation_id) {
+ return WERR_INTERNAL_DB_CORRUPTION;
+ }
schema_info = talloc(mem_ctx, struct dsdb_schema_info);
if (!schema_info) {
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 1f2b1b8e17..eb3400cedc 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -736,7 +736,7 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb,
if (!info_val) {
struct dsdb_schema_info *schema_info;
- status = dsdb_schema_info_create(ldb, mem_ctx, &schema_info);
+ status = dsdb_schema_info_create(ldb, false, mem_ctx, &schema_info);
if (!W_ERROR_IS_OK(status)) {
*error_string = talloc_asprintf(mem_ctx,
"schema_fsmo_init: dsdb_schema_info_create() failed - %s",
diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c
index 9dcf2b8d42..f0c3c068cd 100644
--- a/source4/dsdb/schema/schema_set.c
+++ b/source4/dsdb/schema/schema_set.c
@@ -623,7 +623,7 @@ WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb, const char *pf, const
info_val = ldb_msg_find_ldb_val(msg, "schemaInfo");
if (!info_val) {
- status = dsdb_schema_info_create(ldb, mem_ctx, &schema_info);
+ status = dsdb_schema_info_create(ldb, false, mem_ctx, &schema_info);
W_ERROR_NOT_OK_GOTO(status, failed);
status = dsdb_blob_from_schema_info(schema_info, mem_ctx, &info_val_default);
W_ERROR_NOT_OK_GOTO(status, failed);