summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-11-03 16:25:17 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-11-03 16:36:50 +0100
commitd873fb72bc3f7b410a66f98b5045101292718717 (patch)
tree681ed173b3126e863e82f787f5cfd06b83a036cc /source4
parentb841d12a138a4b9a73f159a7056b0efd64de1289 (diff)
downloadsamba-d873fb72bc3f7b410a66f98b5045101292718717.tar.gz
samba-d873fb72bc3f7b410a66f98b5045101292718717.tar.bz2
samba-d873fb72bc3f7b410a66f98b5045101292718717.zip
s4:objectclass_attrs LDB module - refactor the "dSHeuristics" checker
The checks are done when there are more than 0 values. The other checks should be performed by the other parts of the module.
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/objectclass_attrs.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
index f609e9210b..bd4e0be646 100644
--- a/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
+++ b/source4/dsdb/samdb/ldb_modules/objectclass_attrs.c
@@ -72,21 +72,18 @@ static int oc_op_callback(struct ldb_request *req, struct ldb_reply *ares);
/* checks correctness of dSHeuristics attribute
* as described in MS-ADTS 7.1.1.2.4.1.2 dSHeuristics */
-
static int oc_validate_dsheuristics(struct ldb_message_element *el)
{
- if (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_DELETE ||
- el->num_values < 1) {
- return LDB_SUCCESS;
- }
- if (el->values[0].length > DS_HR_LDAP_BYPASS_UPPER_LIMIT_BOUNDS) {
- return LDB_ERR_CONSTRAINT_VIOLATION;
- } else if (el->values[0].length >= DS_HR_TENTH_CHAR
- && el->values[0].data[DS_HR_TENTH_CHAR-1] != '1') {
- return LDB_ERR_CONSTRAINT_VIOLATION;
- } else {
- return LDB_SUCCESS;
+ if (el->num_values > 0) {
+ if (el->values[0].length > DS_HR_LDAP_BYPASS_UPPER_LIMIT_BOUNDS) {
+ return LDB_ERR_CONSTRAINT_VIOLATION;
+ } else if (el->values[0].length >= DS_HR_TENTH_CHAR
+ && el->values[0].data[DS_HR_TENTH_CHAR-1] != '1') {
+ return LDB_ERR_CONSTRAINT_VIOLATION;
+ }
}
+
+ return LDB_SUCCESS;
}
static int attr_handler(struct oc_context *ac)