summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/modules
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-10-13 20:02:18 +1100
committerAndrew Tridgell <tridge@samba.org>2010-10-13 11:00:04 +0000
commit3d75111fd61d57d2a2fb9e19bf587effb0816339 (patch)
tree8e3d8005ac2091b915ad78894ee22e858dd5c454 /source4/lib/ldb/modules
parentca4864cce695fa1530d8aab50dd82566fc67c6e3 (diff)
downloadsamba-3d75111fd61d57d2a2fb9e19bf587effb0816339.tar.gz
samba-3d75111fd61d57d2a2fb9e19bf587effb0816339.tar.bz2
samba-3d75111fd61d57d2a2fb9e19bf587effb0816339.zip
s4-ldb: added an optional operator_fn in the schema syntax
this function takes the operator being invoked, which will allow schema functions to provide more fine grained control over comparisons. The key bug this was introduced to fix is the incorrect handling of the LDB_OP_PRESENT test for deleted linked attributes. The backends are unaware of the deleted state of these links, so they cannot do a LDB_OP_PRESENT test on their own. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/lib/ldb/modules')
-rw-r--r--source4/lib/ldb/modules/rdn_name.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c
index 5dc122f254..a0867c0f51 100644
--- a/source4/lib/ldb/modules/rdn_name.c
+++ b/source4/lib/ldb/modules/rdn_name.c
@@ -147,9 +147,16 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
}
/* normalise attribute value */
for (i = 0; i < attribute->num_values; i++) {
- ret = a->syntax->comparison_fn(ldb, msg,
- &rdn_val, &attribute->values[i]);
- if (ret == 0) {
+ bool matched;
+ if (a->syntax->operator_fn) {
+ ret = a->syntax->operator_fn(ldb, LDB_OP_EQUALITY, a,
+ &rdn_val, &attribute->values[i], &matched);
+ if (ret != LDB_SUCCESS) return ret;
+ } else {
+ matched = (a->syntax->comparison_fn(ldb, msg,
+ &rdn_val, &attribute->values[i]) == 0);
+ }
+ if (matched) {
/* overwrite so it matches in case */
attribute->values[i] = rdn_val;
break;