diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-10-12 06:10:23 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:39:41 -0500 |
commit | a599edf04cbdeef9014923ba0d3713b8ff84f266 (patch) | |
tree | 3754385df962fd26fe8bd0e16f3c3b706a385c24 /source4/lib/ldb/common/ldb_match.c | |
parent | 655138602c75925a6d655841ee80cf5346a9a399 (diff) | |
download | samba-a599edf04cbdeef9014923ba0d3713b8ff84f266.tar.gz samba-a599edf04cbdeef9014923ba0d3713b8ff84f266.tar.bz2 samba-a599edf04cbdeef9014923ba0d3713b8ff84f266.zip |
r10913: This patch isn't as big as it looks ...
most of the changes are fixes to make all the ldb code compile without
warnings on gcc4. Unfortunately That required a lot of casts :-(
I have also added the start of an 'operational' module, which will
replace the timestamp module, plus add support for some other
operational attributes
In ldb_msg_*() I added some new utility functions to make the
operational module sane, and remove the 'ldb' argument from the
ldb_msg_add_*() functions. That argument was only needed back in the
early days of ldb when we didn't use the hierarchical talloc and thus
needed a place to get the allocation function from. Now its just a
pain to pass around everywhere.
Also added a ldb_debug_set() function that calls ldb_debug() plus sets
the result using ldb_set_errstring(). That saves on some awkward
coding in a few places.
(This used to be commit f6818daecca95760c12f79fd307770cbe3346f57)
Diffstat (limited to 'source4/lib/ldb/common/ldb_match.c')
-rw-r--r-- | source4/lib/ldb/common/ldb_match.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/source4/lib/ldb/common/ldb_match.c b/source4/lib/ldb/common/ldb_match.c index 14031a6dd1..7573cfc808 100644 --- a/source4/lib/ldb/common/ldb_match.c +++ b/source4/lib/ldb/common/ldb_match.c @@ -153,7 +153,8 @@ static int ldb_match_equality(struct ldb_context *ldb, if (ldb_attr_cmp(tree->u.equality.attr, "dn") == 0 || ldb_attr_cmp(tree->u.equality.attr, "distinguishedName") == 0) { - valuedn = ldb_dn_explode_casefold(ldb, tree->u.equality.value.data); + valuedn = ldb_dn_explode_casefold(ldb, + (char *)tree->u.equality.value.data); if (valuedn == NULL) { return 0; } @@ -194,7 +195,7 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, struct ldb_val cnk; struct ldb_val *chunk; char *p, *g; - char *save_p = NULL; + uint8_t *save_p = NULL; int c = 0; h = ldb_attrib_handler(ldb, tree->u.substring.attr); @@ -211,7 +212,7 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, if(h->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto failed; /* FIXME: case of embedded nulls */ - if (strncmp(val.data, cnk.data, cnk.length) != 0) goto failed; + if (strncmp((char *)val.data, (char *)cnk.data, cnk.length) != 0) goto failed; val.length -= cnk.length; val.data += cnk.length; c++; @@ -225,16 +226,16 @@ static int ldb_wildcard_compare(struct ldb_context *ldb, if(h->canonicalise_fn(ldb, ldb, chunk, &cnk) != 0) goto failed; /* FIXME: case of embedded nulls */ - p = strstr(val.data, cnk.data); + p = strstr((char *)val.data, (char *)cnk.data); if (p == NULL) goto failed; if ( (! tree->u.substring.chunks[c + 1]) && (! tree->u.substring.end_with_wildcard) ) { do { /* greedy */ - g = strstr(p + cnk.length, cnk.data); + g = strstr((char *)p + cnk.length, (char *)cnk.data); if (g) p = g; } while(g); } val.length = val.length - (p - (char *)(val.data)) - cnk.length; - val.data = p + cnk.length; + val.data = (uint8_t *)(p + cnk.length); c++; talloc_free(cnk.data); cnk.data = NULL; @@ -282,8 +283,8 @@ static int ldb_match_substring(struct ldb_context *ldb, static int ldb_comparator_and(struct ldb_val *v1, struct ldb_val *v2) { uint64_t i1, i2; - i1 = strtoull(v1->data, NULL, 0); - i2 = strtoull(v2->data, NULL, 0); + i1 = strtoull((char *)v1->data, NULL, 0); + i2 = strtoull((char *)v2->data, NULL, 0); return ((i1 & i2) == i2); } @@ -293,8 +294,8 @@ static int ldb_comparator_and(struct ldb_val *v1, struct ldb_val *v2) static int ldb_comparator_or(struct ldb_val *v1, struct ldb_val *v2) { uint64_t i1, i2; - i1 = strtoull(v1->data, NULL, 0); - i2 = strtoull(v2->data, NULL, 0); + i1 = strtoull((char *)v1->data, NULL, 0); + i2 = strtoull((char *)v2->data, NULL, 0); return ((i1 & i2) != 0); } |