summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-01-12 23:45:02 +0100
committerStefan Metzmacher <metze@samba.org>2010-01-13 16:06:41 +0100
commit1f2efef214d31fa13d197a3ee7ef589c4444b037 (patch)
tree94c7570e70208d55d0ac99de5cd42fb2d362cdeb
parentf0fed6cadd869134e801a652ac650b4a45fa9b42 (diff)
downloadsamba-1f2efef214d31fa13d197a3ee7ef589c4444b037.tar.gz
samba-1f2efef214d31fa13d197a3ee7ef589c4444b037.tar.bz2
samba-1f2efef214d31fa13d197a3ee7ef589c4444b037.zip
s4:dsdb/schema: add dsdb_syntax_OID_validate_ldb()
This is a very heavy weight way of checking this syntax, but it's very complex and using the existing function should be ok for now. We can optimize it later. metze
-rw-r--r--source4/dsdb/schema/schema_syntax.c63
1 files changed, 50 insertions, 13 deletions
diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c
index 99f85c26a8..877200bb08 100644
--- a/source4/dsdb/schema/schema_syntax.c
+++ b/source4/dsdb/schema/schema_syntax.c
@@ -83,18 +83,6 @@ static WERROR dsdb_syntax_FOOBAR_validate_ldb(struct ldb_context *ldb,
return WERR_FOOBAR;
}
-static WERROR dsdb_syntax_ALLOW_validate_ldb(struct ldb_context *ldb,
- const struct dsdb_schema *schema,
- const struct dsdb_attribute *attr,
- const struct ldb_message_element *in)
-{
- if (attr->attributeID_id == 0xFFFFFFFF) {
- return WERR_FOOBAR;
- }
-
- return WERR_OK;
-}
-
static WERROR dsdb_syntax_BOOL_drsuapi_to_ldb(struct ldb_context *ldb,
const struct dsdb_schema *schema,
const struct dsdb_attribute *attr,
@@ -1287,6 +1275,55 @@ static WERROR dsdb_syntax_OID_ldb_to_drsuapi(struct ldb_context *ldb,
return _dsdb_syntax_auto_OID_ldb_to_drsuapi(ldb, schema, attr, in, mem_ctx, out);
}
+static WERROR dsdb_syntax_OID_validate_ldb(struct ldb_context *ldb,
+ const struct dsdb_schema *schema,
+ const struct dsdb_attribute *attr,
+ const struct ldb_message_element *in)
+{
+ WERROR status;
+ struct drsuapi_DsReplicaAttribute drs_tmp;
+ struct ldb_message_element ldb_tmp;
+ TALLOC_CTX *tmp_ctx;
+
+ if (attr->attributeID_id == 0xFFFFFFFF) {
+ return WERR_FOOBAR;
+ }
+
+ /*
+ * TODO: optimize and verify this code
+ */
+
+ tmp_ctx = talloc_new(ldb);
+ if (tmp_ctx == NULL) {
+ return WERR_NOMEM;
+ }
+
+ status = dsdb_syntax_OID_ldb_to_drsuapi(ldb,
+ schema,
+ attr,
+ in,
+ tmp_ctx,
+ &drs_tmp);
+ if (!W_ERROR_IS_OK(status)) {
+ talloc_free(tmp_ctx);
+ return status;
+ }
+
+ status = dsdb_syntax_OID_drsuapi_to_ldb(ldb,
+ schema,
+ attr,
+ &drs_tmp,
+ tmp_ctx,
+ &ldb_tmp);
+ if (!W_ERROR_IS_OK(status)) {
+ talloc_free(tmp_ctx);
+ return status;
+ }
+
+ talloc_free(tmp_ctx);
+ return WERR_OK;
+}
+
static WERROR dsdb_syntax_UNICODE_drsuapi_to_ldb(struct ldb_context *ldb,
const struct dsdb_schema *schema,
const struct dsdb_attribute *attr,
@@ -2237,7 +2274,7 @@ static const struct dsdb_syntax dsdb_syntaxes[] = {
.attributeSyntax_oid = "2.5.5.2",
.drsuapi_to_ldb = dsdb_syntax_OID_drsuapi_to_ldb,
.ldb_to_drsuapi = dsdb_syntax_OID_ldb_to_drsuapi,
- .validate_ldb = dsdb_syntax_ALLOW_validate_ldb,
+ .validate_ldb = dsdb_syntax_OID_validate_ldb,
.equality = "caseIgnoreMatch", /* Would use "objectIdentifierMatch" but most are ldap attribute/class names */
.comment = "OID String",
.ldb_syntax = LDB_SYNTAX_DIRECTORY_STRING