diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-04-22 17:24:15 +0300 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-04-29 04:54:06 +0300 |
commit | 546a727bd326464c6fac3c6454e4e98314e0e75a (patch) | |
tree | fb9f5fde3e11e890e3e9d5cef4a705ad8f928468 /source4/dsdb/schema | |
parent | da127d44e31306b4865e682be362fd9672d8201f (diff) | |
download | samba-546a727bd326464c6fac3c6454e4e98314e0e75a.tar.gz samba-546a727bd326464c6fac3c6454e4e98314e0e75a.tar.bz2 samba-546a727bd326464c6fac3c6454e4e98314e0e75a.zip |
s4/dsdb: Use default schemaInfo value when no such value is given
Having no value for schemaInfo is totally OK as it turns out.
In such cases, we should use a default value with
all fields set to 0.
Diffstat (limited to 'source4/dsdb/schema')
-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; } |