diff options
-rw-r--r-- | source4/dsdb/schema/schema_info_attr.c | 22 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_init.c | 14 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_set.c | 5 |
3 files changed, 25 insertions, 16 deletions
diff --git a/source4/dsdb/schema/schema_info_attr.c b/source4/dsdb/schema/schema_info_attr.c index 855bc6f08c..60722eea52 100644 --- a/source4/dsdb/schema/schema_info_attr.c +++ b/source4/dsdb/schema/schema_info_attr.c @@ -30,6 +30,28 @@ /** + * Creates and initializes new dsdb_schema_info blob value. + * Initial schemaInfo values is with: + * revision = 0 + * invocationId = GUID_ZERO + */ +WERROR dsdb_schema_info_blob_new(TALLOC_CTX *mem_ctx, DATA_BLOB *_schema_info_blob) +{ + DATA_BLOB blob; + + blob = data_blob_talloc_zero(mem_ctx, 21); + W_ERROR_HAVE_NO_MEMORY(blob.data); + + /* Set the schemaInfo marker to 0xFF */ + blob.data[0] = 0xFF; + + *_schema_info_blob = blob; + + return WERR_OK; +} + + +/** * Parse schemaInfo structure from a data_blob * (DATA_BLOB or ldb_val). * Suitable for parsing blobs that comes from diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 3405e155d3..cdd37f094b 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -734,20 +734,10 @@ int dsdb_schema_from_ldb_results(TALLOC_CTX *mem_ctx, struct ldb_context *ldb, } info_val = ldb_msg_find_ldb_val(schema_res->msgs[0], "schemaInfo"); if (!info_val) { - struct dsdb_schema_info *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", - win_errstr(status)); - DEBUG(0,(__location__ ": %s\n", *error_string)); - return LDB_ERR_OPERATIONS_ERROR; - } - status = dsdb_blob_from_schema_info(schema_info, mem_ctx, &info_val_default); + status = dsdb_schema_info_blob_new(mem_ctx, &info_val_default); if (!W_ERROR_IS_OK(status)) { *error_string = talloc_asprintf(mem_ctx, - "schema_fsmo_init: dsdb_blob_from_schema_info() failed - %s", + "schema_fsmo_init: dsdb_schema_info_blob_new() failed - %s", win_errstr(status)); DEBUG(0,(__location__ ": %s\n", *error_string)); return LDB_ERR_OPERATIONS_ERROR; diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c index f0c3c068cd..fe6ef42e8c 100644 --- a/source4/dsdb/schema/schema_set.c +++ b/source4/dsdb/schema/schema_set.c @@ -582,7 +582,6 @@ WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb, const char *pf, const const struct ldb_val *prefix_val; const struct ldb_val *info_val; struct ldb_val info_val_default; - struct dsdb_schema_info *schema_info; mem_ctx = talloc_new(ldb); @@ -623,9 +622,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, 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); + status = dsdb_schema_info_blob_new(mem_ctx, &info_val_default); W_ERROR_NOT_OK_GOTO(status, failed); info_val = &info_val_default; } |