From b7d1586ccd05a78a4fae512c54fa39dda408e08b Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Tue, 17 Aug 2010 03:21:46 +0300 Subject: s4-dsdb: Add context structure for dsdb_syntax conversion functions This structure is intended to hold context-dependent data. Syntax-conversion and object-conversion functions need that data to convert objects and attributes from drs-to-ldb and ldb-to-drs correctly. For instance: ATTID value depends on whether we are converting object from partition different that Schema partition. --- source4/dsdb/schema/schema.h | 6 ++++++ source4/dsdb/schema/schema_syntax.c | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h index 34423be809..2168202d1f 100644 --- a/source4/dsdb/schema/schema.h +++ b/source4/dsdb/schema/schema.h @@ -28,6 +28,12 @@ struct dsdb_attribute; struct dsdb_class; struct dsdb_schema; +struct dsdb_syntax_ctx { + struct ldb_context *ldb; + const struct dsdb_schema *schema; +}; + + struct dsdb_syntax { const char *name; const char *ldap_oid; diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index 193d62dfcc..a6593b4f78 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -31,6 +31,19 @@ #include "../lib/util/charset/charset.h" #include "librpc/ndr/libndr.h" +/** + * Initialize dsdb_syntax_ctx with default values + * for common cases. + */ +void dsdb_syntax_ctx_init(struct dsdb_syntax_ctx *ctx, + struct ldb_context *ldb, + const struct dsdb_schema *schema) +{ + ctx->ldb = ldb; + ctx->schema = schema; +} + + static WERROR dsdb_syntax_FOOBAR_drsuapi_to_ldb(struct ldb_context *ldb, const struct dsdb_schema *schema, const struct dsdb_attribute *attr, -- cgit