From d6f5c1ace215131dc09611abcd2a52254bdab4d6 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 10 Jun 2010 08:27:59 +1000 Subject: s4:dsdb Provide a function to convert from DRS prefix maps to the LDB prefixmap This allows us to push a prefixmap directly into the schema we generate in the provision code. Andrew Bartlett --- source4/dsdb/schema/schema_init.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'source4/dsdb/schema/schema_init.c') diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 47eef5c04f..8e47f1228d 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -168,30 +168,39 @@ WERROR dsdb_get_oid_mappings_drsuapi(const struct dsdb_schema *schema, mem_ctx, _ctr); } -WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema, - TALLOC_CTX *mem_ctx, - struct ldb_val *prefixMap, - struct ldb_val *schemaInfo) +WERROR dsdb_get_drsuapi_prefixmap_as_blob(const struct drsuapi_DsReplicaOIDMapping_Ctr *ctr, + TALLOC_CTX *mem_ctx, + struct ldb_val *prefixMap) { - WERROR status; - enum ndr_err_code ndr_err; - struct drsuapi_DsReplicaOIDMapping_Ctr *ctr; struct prefixMapBlob pfm; - - status = dsdb_get_oid_mappings_drsuapi(schema, false, mem_ctx, &ctr); - W_ERROR_NOT_OK_RETURN(status); - + enum ndr_err_code ndr_err; pfm.version = PREFIX_MAP_VERSION_DSDB; pfm.reserved = 0; pfm.ctr.dsdb = *ctr; ndr_err = ndr_push_struct_blob(prefixMap, mem_ctx, &pfm, (ndr_push_flags_fn_t)ndr_push_prefixMapBlob); - talloc_free(ctr); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NTSTATUS nt_status = ndr_map_error2ntstatus(ndr_err); return ntstatus_to_werror(nt_status); } + return WERR_OK; +} + +WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema, + TALLOC_CTX *mem_ctx, + struct ldb_val *prefixMap, + struct ldb_val *schemaInfo) +{ + WERROR status; + struct drsuapi_DsReplicaOIDMapping_Ctr *ctr; + + status = dsdb_get_oid_mappings_drsuapi(schema, false, mem_ctx, &ctr); + W_ERROR_NOT_OK_RETURN(status); + + status = dsdb_get_drsuapi_prefixmap_as_blob(ctr, mem_ctx, prefixMap); + talloc_free(ctr); + W_ERROR_NOT_OK_RETURN(status); *schemaInfo = strhex_to_data_blob(mem_ctx, schema->schema_info); W_ERROR_HAVE_NO_MEMORY(schemaInfo->data); -- cgit