summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2009-09-25 11:44:22 -0600
committerRich Megginson <rmeggins@redhat.com>2009-09-25 11:55:33 -0600
commitb5b57df80f5a01774f85d174979dc1deea4f5724 (patch)
tree1abd6ba2d901fbaa006c46e02e75900bdccbd463
parentff7d08dc8bd356df7d29c771da420aec2e099e2d (diff)
downloadds-b5b57df80f5a01774f85d174979dc1deea4f5724.tar.gz
ds-b5b57df80f5a01774f85d174979dc1deea4f5724.tar.xz
ds-b5b57df80f5a01774f85d174979dc1deea4f5724.zip
Bitwise Plugin: Bitwise filter doesn't return except the first entry if its multi-valued
http://bugzilla.redhat.com/show_bug.cgi?id=518514 Resolves: bug 518514 Bug Description: Bitwise Plugin: Bitwise filter doesn't return except the first entry if its multi-valued Reviewed by: nhosoi (Thanks!) Fix Description: Get the values as a char ** - look through each one until we find one that matches. Platforms tested: RHEL5 x86_64 Flag Day: no Doc impact: no
-rw-r--r--ldap/servers/plugins/bitwise/bitwise.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ldap/servers/plugins/bitwise/bitwise.c b/ldap/servers/plugins/bitwise/bitwise.c
index 7dbdc1f0..6a4dc65a 100644
--- a/ldap/servers/plugins/bitwise/bitwise.c
+++ b/ldap/servers/plugins/bitwise/bitwise.c
@@ -105,12 +105,16 @@ internal_bitwise_filter_match(void* obj, Slapi_Entry* entry, Slapi_Attr* attr, i
*/
{
struct bitwise_match_cb *bmc = obj;
- unsigned long long a, b;
- char *val_from_entry = NULL;
auto int rc = -1; /* no match */
+ char **ary = NULL;
+ int ii;
- val_from_entry = slapi_entry_attr_get_charptr(entry, bmc->type);
- if (val_from_entry) {
+ ary = slapi_entry_attr_get_charray(entry, bmc->type);
+
+ /* look through all values until we find a match */
+ for (ii = 0; (rc == -1) && ary && ary[ii]; ++ii) {
+ unsigned long long a, b;
+ char *val_from_entry = ary[ii];
errno = 0;
a = strtoull(val_from_entry, NULL, 10);
if (errno != ERANGE) {
@@ -130,8 +134,8 @@ internal_bitwise_filter_match(void* obj, Slapi_Entry* entry, Slapi_Attr* attr, i
}
}
}
- slapi_ch_free_string(&val_from_entry);
}
+ slapi_ch_array_free(ary);
return rc;
}