From 29f9249bd64a1873149e3857483c64b897deac13 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Tue, 30 Nov 2010 12:13:16 +0200 Subject: s4-dsdb/syntax: Implement Remote-ATTID to Local-ATTID mapping function --- source4/dsdb/schema/schema_syntax.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index 0d1d274519..9ef2e32d14 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -70,6 +70,41 @@ uint32_t dsdb_attribute_get_attid(const struct dsdb_attribute *attr, return attr->attributeID_id; } +/** + * Map an ATTID from remote DC to a local ATTID + * using remote prefixMap + */ +static bool dsdb_syntax_attid_from_remote_attid(const struct dsdb_syntax_ctx *ctx, + TALLOC_CTX *mem_ctx, + uint32_t id_remote, + uint32_t *id_local) +{ + WERROR werr; + const char *oid; + + /* + * map remote ATTID to local directly in case + * of no remote prefixMap (during provision for instance) + */ + if (!ctx->pfm_remote) { + *id_local = id_remote; + return true; + } + + werr = dsdb_schema_pfm_oid_from_attid(ctx->pfm_remote, id_remote, mem_ctx, &oid); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(0,("ATTID->OID failed (%s) for: 0x%08X\n", win_errstr(werr), id_remote)); + return false; + } + + werr = dsdb_schema_pfm_attid_from_oid(ctx->schema->prefixmap, oid, id_local); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(0,("OID->ATTID failed (%s) for: %s\n", win_errstr(werr), oid)); + return false; + } + + return true; +} static WERROR dsdb_syntax_FOOBAR_drsuapi_to_ldb(const struct dsdb_syntax_ctx *ctx, const struct dsdb_attribute *attr, -- cgit