1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

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.
This commit is contained in:
Matthias Dieter Wallnöfer 2010-11-03 16:25:17 +01:00
parent b841d12a13
commit d873fb72bc

View File

@ -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)