diff options
-rw-r--r-- | source4/dsdb/repl/replicated_objects.c | 2 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_init.c | 49 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_BecomeDC.c | 4 |
3 files changed, 50 insertions, 5 deletions
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c index 274ba0894f..94805c1150 100644 --- a/source4/dsdb/repl/replicated_objects.c +++ b/source4/dsdb/repl/replicated_objects.c @@ -187,7 +187,7 @@ WERROR dsdb_extended_replicated_objects_commit(struct ldb_context *ldb, uint32_t i; int ret; - status = dsdb_verify_oid_mappings(schema, mapping_ctr); + status = dsdb_verify_oid_mappings_drsuapi(schema, mapping_ctr); W_ERROR_NOT_OK_RETURN(status); out = talloc_zero(mem_ctx, struct dsdb_extended_replicated_objects); diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 22d366d4f3..5785594ada 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -26,8 +26,9 @@ #include "lib/util/dlinklist.h" #include "librpc/gen_ndr/ndr_misc.h" #include "librpc/gen_ndr/ndr_drsuapi.h" +#include "librpc/gen_ndr/ndr_drsblobs.h" -WERROR dsdb_load_oid_mappings(struct dsdb_schema *schema, const struct drsuapi_DsReplicaOIDMapping_Ctr *ctr) +WERROR dsdb_load_oid_mappings_drsuapi(struct dsdb_schema *schema, const struct drsuapi_DsReplicaOIDMapping_Ctr *ctr) { uint32_t i,j; @@ -74,7 +75,51 @@ WERROR dsdb_load_oid_mappings(struct dsdb_schema *schema, const struct drsuapi_D return WERR_OK; } -WERROR dsdb_verify_oid_mappings(const struct dsdb_schema *schema, const struct drsuapi_DsReplicaOIDMapping_Ctr *ctr) +WERROR dsdb_load_oid_mappings_ldb(struct dsdb_schema *schema, + const struct ldb_val *prefixMap, + const struct ldb_val *schemaInfo) +{ + WERROR status; + NTSTATUS nt_status; + struct prefixMapBlob pfm; + char *schema_info; + + nt_status = ndr_pull_struct_blob(prefixMap, schema, &pfm, + (ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob); + if (!NT_STATUS_IS_OK(nt_status)) { + return ntstatus_to_werror(nt_status); + } + + if (pfm.version != PREFIX_MAP_VERSION_DSDB) { + return WERR_FOOBAR; + } + + if (schemaInfo->length != 21 && schemaInfo->data[0] == 0xFF) { + return WERR_FOOBAR; + } + + /* append the schema info as last element */ + pfm.ctr.dsdb.num_mappings++; + pfm.ctr.dsdb.mappings = talloc_realloc(schema, pfm.ctr.dsdb.mappings, + struct drsuapi_DsReplicaOIDMapping, + pfm.ctr.dsdb.num_mappings); + W_ERROR_HAVE_NO_MEMORY(pfm.ctr.dsdb.mappings); + + schema_info = data_blob_hex_string(pfm.ctr.dsdb.mappings, schemaInfo); + W_ERROR_HAVE_NO_MEMORY(schema_info); + + pfm.ctr.dsdb.mappings[pfm.ctr.dsdb.num_mappings - 1].id_prefix = 0; + pfm.ctr.dsdb.mappings[pfm.ctr.dsdb.num_mappings - 1].oid.oid = schema_info; + + /* call the drsuapi version */ + status = dsdb_load_oid_mappings_drsuapi(schema, &pfm.ctr.dsdb); + talloc_free(pfm.ctr.dsdb.mappings); + W_ERROR_NOT_OK_RETURN(status); + + return WERR_OK; +} + +WERROR dsdb_verify_oid_mappings_drsuapi(const struct dsdb_schema *schema, const struct drsuapi_DsReplicaOIDMapping_Ctr *ctr) { uint32_t i,j; diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index b48a4c9853..a23a2e4c3b 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -456,12 +456,12 @@ static NTSTATUS test_become_dc_schema_chunk(void *private_data, s->schema = talloc_zero(s, struct dsdb_schema); NT_STATUS_HAVE_NO_MEMORY(s->schema); - status = dsdb_load_oid_mappings(s->schema, mapping_ctr); + status = dsdb_load_oid_mappings_drsuapi(s->schema, mapping_ctr); if (!W_ERROR_IS_OK(status)) { return werror_to_ntstatus(status); } } else { - status = dsdb_verify_oid_mappings(s->schema, mapping_ctr); + status = dsdb_verify_oid_mappings_drsuapi(s->schema, mapping_ctr); if (!W_ERROR_IS_OK(status)) { return werror_to_ntstatus(status); } |