From c69717755abeaf8bf93e76255d0912e3a24b7cb0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 15 Dec 2006 13:08:57 +0000 Subject: r20184: change ldb_attrib_handler into ldb_schema_attribute, which has a pointer to a ldb_schema_syntax struct. the default attribute handler is now registered dynamicly as "*" attribute, instead of having its own code path. ldb_schema_attribute's can be added to the ldb_schema given a ldb_schema_syntax struct or the syntax name we may also need to introduce a ldb_schema_matching_rule, and add a pointer to a default ldb_schema_matching_rule in the ldb_schema_syntax. metze (This used to be commit b97b8f5dcbce006f005e53ca79df3330e62f117b) --- source4/lib/ldb/common/ldb_match.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'source4/lib/ldb/common/ldb_match.c') diff --git a/source4/lib/ldb/common/ldb_match.c b/source4/lib/ldb/common/ldb_match.c index 524214992b..df11107402 100644 --- a/source4/lib/ldb/common/ldb_match.c +++ b/source4/lib/ldb/common/ldb_match.c @@ -104,7 +104,7 @@ static int ldb_match_comparison(struct ldb_context *ldb, { unsigned int i; struct ldb_message_element *el; - const struct ldb_attrib_handler *h; + const struct ldb_schema_attribute *a; int ret; /* FIXME: APPROX comparison not handled yet */ @@ -115,10 +115,10 @@ static int ldb_match_comparison(struct ldb_context *ldb, return 0; } - h = ldb_attrib_handler(ldb, el->name); + a = ldb_schema_attribute_by_name(ldb, el->name); for (i = 0; i < el->num_values; i++) { - ret = h->comparison_fn(ldb, ldb, &el->values[i], &tree->u.comparison.value); + ret = a->syntax->comparison_fn(ldb, ldb, &el->values[i], &tree->u.comparison.value); if (ret == 0) { return 1; @@ -144,7 +144,7 @@ static int ldb_match_equality(struct ldb_context *ldb, { unsigned int i; struct ldb_message_element *el; - const struct ldb_attrib_handler *h; + const struct ldb_schema_attribute *a; struct ldb_dn *valuedn; int ret; @@ -169,11 +169,11 @@ static int ldb_match_equality(struct ldb_context *ldb, return 0; } - h = ldb_attrib_handler(ldb, el->name); + a = ldb_schema_attribute_by_name(ldb, el->name); for (i=0;inum_values;i++) { - if (h->comparison_fn(ldb, ldb, &tree->u.equality.value, - &el->values[i]) == 0) { + if (a->syntax->comparison_fn(ldb, ldb, &tree->u.equality.value, + &el->values[i]) == 0) { return 1; } } @@ -185,7 +185,7 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, const struct ldb_parse_tree *tree, const struct ldb_val value) { - const struct ldb_attrib_handler *h; + const struct ldb_schema_attribute *a; struct ldb_val val; struct ldb_val cnk; struct ldb_val *chunk; @@ -193,9 +193,9 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, uint8_t *save_p = NULL; int c = 0; - h = ldb_attrib_handler(ldb, tree->u.substring.attr); + a = ldb_schema_attribute_by_name(ldb, tree->u.substring.attr); - if(h->canonicalise_fn(ldb, ldb, &value, &val) != 0) + if(a->syntax->canonicalise_fn(ldb, ldb, &value, &val) != 0) return -1; save_p = val.data; @@ -204,7 +204,7 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, if ( ! tree->u.substring.start_with_wildcard ) { chunk = tree->u.substring.chunks[c]; - if(h->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto failed; + if(a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto failed; /* This deals with wildcard prefix searches on binary attributes (eg objectGUID) */ if (cnk.length > val.length) { @@ -221,7 +221,7 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, while (tree->u.substring.chunks[c]) { chunk = tree->u.substring.chunks[c]; - if(h->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto failed; + if(a->syntax->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto failed; /* FIXME: case of embedded nulls */ p = strstr((char *)val.data, (char *)cnk.data); -- cgit