[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Wed Jan 13 08:07:45 MST 2010


The branch, master has been updated
       via  204e4b2... s4:dsdb: use validate_update module
       via  1f2efef... s4:dsdb/schema: add dsdb_syntax_OID_validate_ldb()
       via  f0fed6c... s4:dsdb/schema: add dsdb_syntax_DN_STRING_validate_ldb()
       via  83baa44... s4:dsdb/schema: add dsdb_syntax_DN_BINARY_validate_ldb()
       via  39dda46... s4:dsdb/schema: add dsdb_syntax_DN_validate_ldb()
       via  4fa2bf8... s4:dsdb/schema: add dsdb_syntax_PRESENTATION_ADDRESS_validate_ldb()
       via  ba8a930... s4:dsdb/schema: add dsdb_syntax_UNICODE_validate_ldb()
       via  674e835... s4:dsdb/schema: add dsdb_syntax_DATA_BLOB_validate_ldb()
       via  e2b9454... s4:dsdb/schema: add dsdb_syntax_NTTIME_validate_ldb()
       via  eb261a9... s4:dsdb/schema: add dsdb_syntax_NTTIME_UTC_validate_ldb()
       via  5f13a16... s4:dsdb/schema: add dsdb_syntax_INT64_validate_ldb()
       via  ece3def... s4:dsdb/schema: add dsdb_syntax_INT32_validate_ldb()
       via  a0f2a49... s4:dsdb/schema: add dsdb_syntax_BOOL_validate_ldb()
       via  bf1f067... s4:dsdb: add validate_update module
       via  b20707c... s4:dsdb/schema: add inftrastructure for dsdb_validate_ldb()
       via  6158908... s4:dsdb/schema: add dsdb_syntax_DN_STRING_* wrappers
      from  24ecd19... s4:dsdb/resolve_oids: also resolve oid in search attribute list

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 204e4b26aecb7e51da80cbf63efe952d17bbe856
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 11:14:33 2009 +0200

    s4:dsdb: use validate_update module
    
    metze

commit 1f2efef214d31fa13d197a3ee7ef589c4444b037
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jan 12 23:45:02 2010 +0100

    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

commit f0fed6cadd869134e801a652ac650b4a45fa9b42
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_DN_STRING_validate_ldb()
    
    metze

commit 83baa44c6737ffb08417221c12e2b7dd902ebdeb
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_DN_BINARY_validate_ldb()
    
    metze

commit 39dda462cd4fbbc1e9ece415f850f42fd8010b43
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_DN_validate_ldb()
    
    metze

commit 4fa2bf81843654ebad47cd36b441f337db95b1c6
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_PRESENTATION_ADDRESS_validate_ldb()
    
    metze

commit ba8a930d0e428ef7a97cc29b345d02d2be68a1b3
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_UNICODE_validate_ldb()
    
    metze

commit 674e8350b6dea6a04dc719932339d5097f59ca42
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_DATA_BLOB_validate_ldb()
    
    metze

commit e2b9454d36ab84d34db00301af9c46b0f57fcc24
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_NTTIME_validate_ldb()
    
    metze

commit eb261a9fda9a471f70f892949b472d6bf08d0e7b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_NTTIME_UTC_validate_ldb()
    
    metze

commit 5f13a162954cbab8eaec9864c59601d244a0237a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_INT64_validate_ldb()
    
    metze

commit ece3defd15246f232acaf0c2c29b66da2924438a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_INT32_validate_ldb()
    
    metze

commit a0f2a49b8a67a60c2ecc188043848140a3e944c2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_BOOL_validate_ldb()
    
    metze

commit bf1f067b0c46f1c8378e6a517feeaad9b5c2b17c
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 11:14:09 2009 +0200

    s4:dsdb: add validate_update module
    
    metze

commit b20707c11af4834693947265873e1b96d316b4e1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add inftrastructure for dsdb_validate_ldb()
    
    metze

commit 61589085c4207ab730654d9f881a2615e483a167
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 18:57:01 2009 +0200

    s4:dsdb/schema: add dsdb_syntax_DN_STRING_* wrappers
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source4/dsdb/samdb/ldb_modules/config.mk         |   11 +-
 source4/dsdb/samdb/ldb_modules/samba_dsdb.c      |    1 +
 source4/dsdb/samdb/ldb_modules/validate_update.c |  120 ++++
 source4/dsdb/schema/schema.h                     |    4 +
 source4/dsdb/schema/schema_syntax.c              |  696 +++++++++++++++++++++-
 5 files changed, 829 insertions(+), 3 deletions(-)
 create mode 100644 source4/dsdb/samdb/ldb_modules/validate_update.c


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk
index f9f1714..e13f44a 100644
--- a/source4/dsdb/samdb/ldb_modules/config.mk
+++ b/source4/dsdb/samdb/ldb_modules/config.mk
@@ -437,7 +437,6 @@ ldb_resolve_oids_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/resolve_oids.o
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSECURITY SAMDB
 SUBSYSTEM = LIBLDB
 INIT_FUNCTION = LDB_MODULE(acl)
-
 # End MODULE ldb_acl
 ################################################
 
@@ -454,3 +453,13 @@ INIT_FUNCTION = LDB_MODULE(lazy_commit)
 ################################################
 
 ldb_lazy_commit_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/lazy_commit.o
+
+# Start MODULE ldb_validate_update
+[MODULE::ldb_validate_update]
+PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBSECURITY SAMDB
+SUBSYSTEM = LIBLDB
+INIT_FUNCTION = LDB_MODULE(validate_update)
+# End MODULE ldb_validate_update
+################################################
+
+ldb_validate_update_OBJ_FILES = $(dsdbsrcdir)/samdb/ldb_modules/validate_update.o
diff --git a/source4/dsdb/samdb/ldb_modules/samba_dsdb.c b/source4/dsdb/samdb/ldb_modules/samba_dsdb.c
index 4452612..c929d65 100644
--- a/source4/dsdb/samdb/ldb_modules/samba_dsdb.c
+++ b/source4/dsdb/samdb/ldb_modules/samba_dsdb.c
@@ -182,6 +182,7 @@ static int samba_dsdb_init(struct ldb_module *module)
 					     "samldb",
 					     "password_hash",
 					     "operational",
+					     "validate_update",
 					     "kludge_acl",
 					     "schema_load",
 					     "instancetype",
diff --git a/source4/dsdb/samdb/ldb_modules/validate_update.c b/source4/dsdb/samdb/ldb_modules/validate_update.c
new file mode 100644
index 0000000..900b3d0
--- /dev/null
+++ b/source4/dsdb/samdb/ldb_modules/validate_update.c
@@ -0,0 +1,120 @@
+/*
+   ldb database library
+
+   Copyright (C) Stefan Metzmacher <metze at samba.org> 2009
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "ldb_module.h"
+#include "dsdb/samdb/samdb.h"
+
+static int validate_update_message(struct ldb_context *ldb,
+				   struct dsdb_schema *schema,
+				   const struct ldb_message *msg)
+{
+	int i;
+
+	for (i=0; i < msg->num_elements; i++) {
+		WERROR werr;
+
+		werr = dsdb_attribute_validate_ldb(ldb, schema,
+						   &msg->elements[i]);
+		if (!W_ERROR_IS_OK(werr)) {
+			int j;
+
+			ldb_debug(ldb, LDB_DEBUG_ERROR,
+				  "TODO: object[%s] add/modify attribute[%d|%s] num_values[%d] - %s\n",
+				  ldb_dn_get_linearized(msg->dn),
+				  i, msg->elements[i].name,
+				  msg->elements[i].num_values,
+				  win_errstr(werr));
+
+			for (j=0; j < msg->elements[i].num_values; j++) {
+				ldb_debug(ldb, LDB_DEBUG_ERROR,
+					  "TODO: value[%d] len[%d]\n", j,
+					  msg->elements[i].values[j].length);
+				dump_data(0,
+					  msg->elements[i].values[j].data,
+					  msg->elements[i].values[j].length);
+			}
+
+			return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX;
+		}
+	}
+
+	return LDB_SUCCESS;
+}
+
+static int validate_update_add(struct ldb_module *module, struct ldb_request *req)
+{
+	struct ldb_context *ldb;
+	struct dsdb_schema *schema;
+	int ret;
+
+	ldb = ldb_module_get_ctx(module);
+	schema = dsdb_get_schema(ldb);
+
+	if (!schema) {
+		return ldb_next_request(module, req);
+	}
+
+	/* do not manipulate our control entries */
+	if (ldb_dn_is_special(req->op.add.message->dn)) {
+		return ldb_next_request(module, req);
+	}
+
+	ret = validate_update_message(ldb, schema,
+				      req->op.add.message);
+	if (ret != LDB_SUCCESS) {
+		return ret;
+	}
+
+	return ldb_next_request(module, req);
+}
+
+static int validate_update_modify(struct ldb_module *module, struct ldb_request *req)
+{
+	struct ldb_context *ldb;
+	struct dsdb_schema *schema;
+	int ret;
+
+	ldb = ldb_module_get_ctx(module);
+	schema = dsdb_get_schema(ldb);
+
+	if (!schema) {
+		return ldb_next_request(module, req);
+	}
+
+	/* do not manipulate our control entries */
+	if (ldb_dn_is_special(req->op.mod.message->dn)) {
+		return ldb_next_request(module, req);
+	}
+
+	ret = validate_update_message(ldb, schema,
+				      req->op.mod.message);
+	if (ret != LDB_SUCCESS) {
+		return ret;
+	}
+
+	return ldb_next_request(module, req);
+}
+
+_PUBLIC_ const struct ldb_module_ops ldb_validate_update_module_ops = {
+	.name		= "validate_update",
+	.add		= validate_update_add,
+	.modify		= validate_update_modify,
+};
+
diff --git a/source4/dsdb/schema/schema.h b/source4/dsdb/schema/schema.h
index 1a40c45..fb1bd3c 100644
--- a/source4/dsdb/schema/schema.h
+++ b/source4/dsdb/schema/schema.h
@@ -51,6 +51,10 @@ struct dsdb_syntax {
 				 const struct ldb_message_element *in,
 				 TALLOC_CTX *mem_ctx,
 				 struct drsuapi_DsReplicaAttribute *out);
+	WERROR (*validate_ldb)(struct ldb_context *ldb,
+			       const struct dsdb_schema *schema,
+			       const struct dsdb_attribute *attr,
+			       const struct ldb_message_element *in);
 };
 
 struct dsdb_attribute {
diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c
index 48c2031..877200b 100644
--- a/source4/dsdb/schema/schema_syntax.c
+++ b/source4/dsdb/schema/schema_syntax.c
@@ -75,6 +75,14 @@ static WERROR dsdb_syntax_FOOBAR_ldb_to_drsuapi(struct ldb_context *ldb,
 	return WERR_FOOBAR;
 }
 
+static WERROR dsdb_syntax_FOOBAR_validate_ldb(struct ldb_context *ldb,
+					      const struct dsdb_schema *schema,
+					      const struct dsdb_attribute *attr,
+					      const struct ldb_message_element *in)
+{
+	return WERR_FOOBAR;
+}
+
 static WERROR dsdb_syntax_BOOL_drsuapi_to_ldb(struct ldb_context *ldb, 
 					      const struct dsdb_schema *schema,
 					      const struct dsdb_attribute *attr,
@@ -162,6 +170,35 @@ static WERROR dsdb_syntax_BOOL_ldb_to_drsuapi(struct ldb_context *ldb,
 	return WERR_OK;
 }
 
+static WERROR dsdb_syntax_BOOL_validate_ldb(struct ldb_context *ldb,
+					    const struct dsdb_schema *schema,
+					    const struct dsdb_attribute *attr,
+					    const struct ldb_message_element *in)
+{
+	uint32_t i;
+
+	if (attr->attributeID_id == 0xFFFFFFFF) {
+		return WERR_FOOBAR;
+	}
+
+	for (i=0; i < in->num_values; i++) {
+		int t, f;
+
+		t = strncmp("TRUE",
+			    (const char *)in->values[i].data,
+			    in->values[i].length);
+		f = strncmp("FALSE",
+			    (const char *)in->values[i].data,
+			    in->values[i].length);
+
+		if (t != 0 && f != 0) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+	}
+
+	return WERR_OK;
+}
+
 static WERROR dsdb_syntax_INT32_drsuapi_to_ldb(struct ldb_context *ldb, 
 					       const struct dsdb_schema *schema,
 					       const struct dsdb_attribute *attr,
@@ -244,6 +281,53 @@ static WERROR dsdb_syntax_INT32_ldb_to_drsuapi(struct ldb_context *ldb,
 	return WERR_OK;
 }
 
+static WERROR dsdb_syntax_INT32_validate_ldb(struct ldb_context *ldb,
+					     const struct dsdb_schema *schema,
+					     const struct dsdb_attribute *attr,
+					     const struct ldb_message_element *in)
+{
+	uint32_t i;
+
+	if (attr->attributeID_id == 0xFFFFFFFF) {
+		return WERR_FOOBAR;
+	}
+
+	for (i=0; i < in->num_values; i++) {
+		long v;
+		char buf[sizeof("-2147483648")];
+		char *end = NULL;
+
+		ZERO_STRUCT(buf);
+		if (in->values[i].length >= sizeof(buf)) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+
+		memcpy(buf, in->values[i].data, in->values[i].length);
+		errno = 0;
+		v = strtol(buf, &end, 10);
+		if (errno != 0) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+		if (end && end[0] != '\0') {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+
+		if (attr->rangeLower) {
+			if ((int32_t)v < (int32_t)*attr->rangeLower) {
+				return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+			}
+		}
+
+		if (attr->rangeUpper) {
+			if ((int32_t)v > (int32_t)*attr->rangeUpper) {
+				return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+			}
+		}
+	}
+
+	return WERR_OK;
+}
+
 static WERROR dsdb_syntax_INT64_drsuapi_to_ldb(struct ldb_context *ldb, 
 					       const struct dsdb_schema *schema,
 					       const struct dsdb_attribute *attr,
@@ -324,6 +408,52 @@ static WERROR dsdb_syntax_INT64_ldb_to_drsuapi(struct ldb_context *ldb,
 	return WERR_OK;
 }
 
+static WERROR dsdb_syntax_INT64_validate_ldb(struct ldb_context *ldb,
+					     const struct dsdb_schema *schema,
+					     const struct dsdb_attribute *attr,
+					     const struct ldb_message_element *in)
+{
+	uint32_t i;
+
+	if (attr->attributeID_id == 0xFFFFFFFF) {
+		return WERR_FOOBAR;
+	}
+
+	for (i=0; i < in->num_values; i++) {
+		long long v;
+		char buf[sizeof("-9223372036854775808")];
+		char *end = NULL;
+
+		ZERO_STRUCT(buf);
+		if (in->values[i].length >= sizeof(buf)) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+		memcpy(buf, in->values[i].data, in->values[i].length);
+
+		errno = 0;
+		v = strtoll(buf, &end, 10);
+		if (errno != 0) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+		if (end && end[0] != '\0') {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+
+		if (attr->rangeLower) {
+			if ((int64_t)v < (int64_t)*attr->rangeLower) {
+				return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+			}
+		}
+
+		if (attr->rangeUpper) {
+			if ((int64_t)v > (int64_t)*attr->rangeUpper) {
+				return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+			}
+		}
+	}
+
+	return WERR_OK;
+}
 static WERROR dsdb_syntax_NTTIME_UTC_drsuapi_to_ldb(struct ldb_context *ldb, 
 						    const struct dsdb_schema *schema,
 						    const struct dsdb_attribute *attr,
@@ -418,6 +548,54 @@ static WERROR dsdb_syntax_NTTIME_UTC_ldb_to_drsuapi(struct ldb_context *ldb,
 	return WERR_OK;
 }
 
+static WERROR dsdb_syntax_NTTIME_UTC_validate_ldb(struct ldb_context *ldb,
+						  const struct dsdb_schema *schema,
+						  const struct dsdb_attribute *attr,
+						  const struct ldb_message_element *in)
+{
+	uint32_t i;
+
+	if (attr->attributeID_id == 0xFFFFFFFF) {
+		return WERR_FOOBAR;
+	}
+
+	for (i=0; i < in->num_values; i++) {
+		time_t t;
+		char buf[sizeof("090826075717Z")];
+
+		ZERO_STRUCT(buf);
+		if (in->values[i].length >= sizeof(buf)) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+		memcpy(buf, in->values[i].data, in->values[i].length);
+
+		errno = 0;
+		t = ldb_string_utc_to_time(buf);
+		if (errno != 0) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+
+		if (attr->rangeLower) {
+			if ((int32_t)t < (int32_t)*attr->rangeLower) {
+				return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+			}
+		}
+
+		if (attr->rangeUpper) {
+			if ((int32_t)t > (int32_t)*attr->rangeLower) {
+				return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+			}
+		}
+
+		/*
+		 * TODO: verify the comment in the
+		 * dsdb_syntax_NTTIME_UTC_drsuapi_to_ldb() function!
+		 */
+	}
+
+	return WERR_OK;
+}
+
 static WERROR dsdb_syntax_NTTIME_drsuapi_to_ldb(struct ldb_context *ldb, 
 						const struct dsdb_schema *schema,
 						const struct dsdb_attribute *attr,
@@ -508,6 +686,42 @@ static WERROR dsdb_syntax_NTTIME_ldb_to_drsuapi(struct ldb_context *ldb,
 	return WERR_OK;
 }
 
+static WERROR dsdb_syntax_NTTIME_validate_ldb(struct ldb_context *ldb,
+					      const struct dsdb_schema *schema,
+					      const struct dsdb_attribute *attr,
+					      const struct ldb_message_element *in)
+{
+	uint32_t i;
+
+	if (attr->attributeID_id == 0xFFFFFFFF) {
+		return WERR_FOOBAR;
+	}
+
+	for (i=0; i < in->num_values; i++) {
+		time_t t;
+		int ret;
+
+		ret = ldb_val_to_time(&in->values[i], &t);
+		if (ret != LDB_SUCCESS) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+
+		if (attr->rangeLower) {
+			if ((int32_t)t < (int32_t)*attr->rangeLower) {
+				return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+			}
+		}
+
+		if (attr->rangeUpper) {
+			if ((int32_t)t > (int32_t)*attr->rangeLower) {
+				return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+			}
+		}
+	}
+
+	return WERR_OK;
+}
+
 static WERROR dsdb_syntax_DATA_BLOB_drsuapi_to_ldb(struct ldb_context *ldb, 
 						   const struct dsdb_schema *schema,
 						   const struct dsdb_attribute *attr,
@@ -576,6 +790,59 @@ static WERROR dsdb_syntax_DATA_BLOB_ldb_to_drsuapi(struct ldb_context *ldb,
 	return WERR_OK;
 }
 
+static WERROR dsdb_syntax_DATA_BLOB_validate_one_val(struct ldb_context *ldb,
+						     const struct dsdb_schema *schema,
+						     const struct dsdb_attribute *attr,
+						     const struct ldb_val *val)
+{
+	if (attr->attributeID_id == 0xFFFFFFFF) {
+		return WERR_FOOBAR;
+	}
+
+	if (attr->rangeLower) {
+		if ((uint32_t)val->length < (uint32_t)*attr->rangeLower) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+	}
+
+	if (attr->rangeUpper) {
+		if ((uint32_t)val->length > (uint32_t)*attr->rangeUpper) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+	}
+
+	return WERR_OK;
+}
+
+static WERROR dsdb_syntax_DATA_BLOB_validate_ldb(struct ldb_context *ldb,
+						 const struct dsdb_schema *schema,
+						 const struct dsdb_attribute *attr,
+						 const struct ldb_message_element *in)
+{
+	uint32_t i;
+	WERROR status;
+
+	if (attr->attributeID_id == 0xFFFFFFFF) {
+		return WERR_FOOBAR;
+	}
+
+	for (i=0; i < in->num_values; i++) {
+		if (in->values[i].length == 0) {
+			return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
+		}
+
+		status = dsdb_syntax_DATA_BLOB_validate_one_val(ldb,
+								schema,
+								attr,
+								&in->values[i]);
+		if (!W_ERROR_IS_OK(status)) {
+			return status;
+		}
+	}
+
+	return WERR_OK;
+}
+
 static WERROR _dsdb_syntax_auto_OID_drsuapi_to_ldb(struct ldb_context *ldb,
 						   const struct dsdb_schema *schema,
 						   const struct dsdb_attribute *attr,
@@ -1008,6 +1275,55 @@ static WERROR dsdb_syntax_OID_ldb_to_drsuapi(struct ldb_context *ldb,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list