From 01302b8202cadcacf245b9f68ca765f03bf38a0b Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Mon, 26 Oct 2009 03:35:29 +0200 Subject: s4/drs: dsdb_map_oid2int() replaced by dsdb_schema_pfm_make_attid() Signed-off-by: Stefan Metzmacher --- source4/dsdb/samdb/ldb_modules/schema_data.c | 4 ++-- source4/dsdb/schema/schema_init.c | 24 ++++++++++++------------ source4/dsdb/schema/schema_syntax.c | 10 +++++----- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'source4') diff --git a/source4/dsdb/samdb/ldb_modules/schema_data.c b/source4/dsdb/samdb/ldb_modules/schema_data.c index bf80c01b0f..9951bd6da2 100644 --- a/source4/dsdb/samdb/ldb_modules/schema_data.c +++ b/source4/dsdb/samdb/ldb_modules/schema_data.c @@ -140,7 +140,7 @@ static int schema_data_add(struct ldb_module *module, struct ldb_request *req) const struct ldb_val *governsID = NULL; const char *oid_attr = NULL; const char *oid = NULL; - uint32_t id32; + uint32_t attid; WERROR status; ldb = ldb_module_get_ctx(module); @@ -184,7 +184,7 @@ static int schema_data_add(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } - status = dsdb_map_oid2int(schema, oid, &id32); + status = dsdb_schema_pfm_make_attid(schema->prefixmap, oid, &attid); if (W_ERROR_IS_OK(status)) { return ldb_next_request(module, req); } else if (!W_ERROR_EQUAL(WERR_DS_NO_MSDS_INTID, status)) { diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c index 0796200cb0..1d2363bfa6 100644 --- a/source4/dsdb/schema/schema_init.c +++ b/source4/dsdb/schema/schema_init.c @@ -158,12 +158,6 @@ WERROR dsdb_get_oid_mappings_ldb(const struct dsdb_schema *schema, } -WERROR dsdb_map_oid2int(const struct dsdb_schema *schema, const char *in, uint32_t *out) -{ - return dsdb_find_prefix_for_oid(schema->num_prefixes, schema->prefixes, in, out); -} - - WERROR dsdb_map_int2oid(const struct dsdb_schema *schema, uint32_t in, TALLOC_CTX *mem_ctx, const char **out) { uint32_t i; @@ -687,7 +681,9 @@ WERROR dsdb_attribute_from_ldb(struct ldb_context *ldb, /* set an invalid value */ attr->attributeID_id = 0xFFFFFFFF; } else { - status = dsdb_map_oid2int(schema, attr->attributeID_oid, &attr->attributeID_id); + status = dsdb_schema_pfm_make_attid(schema->prefixmap, + attr->attributeID_oid, + &attr->attributeID_id); if (!W_ERROR_IS_OK(status)) { DEBUG(0,("%s: '%s': unable to map attributeID %s: %s\n", __location__, attr->lDAPDisplayName, attr->attributeID_oid, @@ -710,7 +706,9 @@ WERROR dsdb_attribute_from_ldb(struct ldb_context *ldb, /* set an invalid value */ attr->attributeSyntax_id = 0xFFFFFFFF; } else { - status = dsdb_map_oid2int(schema, attr->attributeSyntax_oid, &attr->attributeSyntax_id); + status = dsdb_schema_pfm_make_attid(schema->prefixmap, + attr->attributeSyntax_oid, + &attr->attributeSyntax_id); if (!W_ERROR_IS_OK(status)) { DEBUG(0,("%s: '%s': unable to map attributeSyntax_ %s: %s\n", __location__, attr->lDAPDisplayName, attr->attributeSyntax_oid, @@ -763,7 +761,9 @@ WERROR dsdb_class_from_ldb(const struct dsdb_schema *schema, /* set an invalid value */ obj->governsID_id = 0xFFFFFFFF; } else { - status = dsdb_map_oid2int(schema, obj->governsID_oid, &obj->governsID_id); + status = dsdb_schema_pfm_make_attid(schema->prefixmap, + obj->governsID_oid, + &obj->governsID_id); if (!W_ERROR_IS_OK(status)) { DEBUG(0,("%s: '%s': unable to map governsID %s: %s\n", __location__, obj->lDAPDisplayName, obj->governsID_oid, @@ -973,7 +973,7 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb uint32_t *idx) { WERROR status; - uint32_t i, id; + uint32_t i, attid; const char *oid = NULL; for(i=0; i < ARRAY_SIZE(name_mappings); i++) { @@ -987,13 +987,13 @@ static struct drsuapi_DsReplicaAttribute *dsdb_find_object_attr_name(struct dsdb return NULL; } - status = dsdb_map_oid2int(schema, oid, &id); + status = dsdb_schema_pfm_make_attid(schema->prefixmap, oid, &attid); if (!W_ERROR_IS_OK(status)) { return NULL; } for (i=0; i < obj->attribute_ctr.num_attributes; i++) { - if (obj->attribute_ctr.attributes[i].attid != id) continue; + if (obj->attribute_ctr.attributes[i].attid != attid) continue; if (idx) *idx = i; return &obj->attribute_ctr.attributes[i]; diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index cbbd4a8636..f656728a54 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -806,7 +806,7 @@ static WERROR _dsdb_syntax_OID_oid_ldb_to_drsuapi(struct ldb_context *ldb, W_ERROR_HAVE_NO_MEMORY(blobs); for (i=0; i < in->num_values; i++) { - uint32_t v; + uint32_t attid; WERROR status; out->value_ctr.values[i].blob= &blobs[i]; @@ -814,12 +814,12 @@ static WERROR _dsdb_syntax_OID_oid_ldb_to_drsuapi(struct ldb_context *ldb, blobs[i] = data_blob_talloc(blobs, NULL, 4); W_ERROR_HAVE_NO_MEMORY(blobs[i].data); - status = dsdb_map_oid2int(schema, - (const char *)in->values[i].data, - &v); + status = dsdb_schema_pfm_make_attid(schema->prefixmap, + (const char *)in->values[i].data, + &attid); W_ERROR_NOT_OK_RETURN(status); - SIVAL(blobs[i].data, 0, v); + SIVAL(blobs[i].data, 0, attid); } return WERR_OK; -- cgit