summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-09-29 18:57:01 +0200
committerStefan Metzmacher <metze@samba.org>2010-01-13 16:06:38 +0100
commite2b9454d36ab84d34db00301af9c46b0f57fcc24 (patch)
tree93d5c54eaf0cde20d33beec2bbdf951d19fdf987 /source4/dsdb/schema
parenteb261a9fda9a471f70f892949b472d6bf08d0e7b (diff)
downloadsamba-e2b9454d36ab84d34db00301af9c46b0f57fcc24.tar.gz
samba-e2b9454d36ab84d34db00301af9c46b0f57fcc24.tar.bz2
samba-e2b9454d36ab84d34db00301af9c46b0f57fcc24.zip
s4:dsdb/schema: add dsdb_syntax_NTTIME_validate_ldb()
metze
Diffstat (limited to 'source4/dsdb/schema')
-rw-r--r--source4/dsdb/schema/schema_syntax.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c
index 3805df6463..6dc334e736 100644
--- a/source4/dsdb/schema/schema_syntax.c
+++ b/source4/dsdb/schema/schema_syntax.c
@@ -698,6 +698,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,
@@ -1912,7 +1948,7 @@ static const struct dsdb_syntax dsdb_syntaxes[] = {
.attributeSyntax_oid = "2.5.5.11",
.drsuapi_to_ldb = dsdb_syntax_NTTIME_drsuapi_to_ldb,
.ldb_to_drsuapi = dsdb_syntax_NTTIME_ldb_to_drsuapi,
- .validate_ldb = dsdb_syntax_ALLOW_validate_ldb,
+ .validate_ldb = dsdb_syntax_NTTIME_validate_ldb,
.equality = "generalizedTimeMatch",
.comment = "Generalized Time",
.ldb_syntax = LDB_SYNTAX_UTC_TIME,