From b5b57df80f5a01774f85d174979dc1deea4f5724 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Fri, 25 Sep 2009 11:44:22 -0600 Subject: 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 --- ldap/servers/plugins/bitwise/bitwise.c | 14 +++++++++----- 1 file 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; } -- cgit