summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-08-17 03:21:46 +0300
committerKamen Mazdrashki <kamenim@samba.org>2010-08-19 03:34:01 +0300
commitb7d1586ccd05a78a4fae512c54fa39dda408e08b (patch)
tree514e9262ea99d75d5c8fb69f14c642e6f72816bf /source4/dsdb
parent20a8481d3ff149e3cece6f2d8d2cf6ae8462d11a (diff)
downloadsamba-b7d1586ccd05a78a4fae512c54fa39dda408e08b.tar.gz
samba-b7d1586ccd05a78a4fae512c54fa39dda408e08b.tar.bz2
samba-b7d1586ccd05a78a4fae512c54fa39dda408e08b.zip
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.
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/schema/schema.h6
-rw-r--r--source4/dsdb/schema/schema_syntax.c13
2 files changed, 19 insertions, 0 deletions
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,