Browse Source

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

Rich Megginson 16 years ago
parent
commit
b5b57df80f
1 changed files with 9 additions and 5 deletions
  1. 9 5
      ldap/servers/plugins/bitwise/bitwise.c

+ 9 - 5
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;
 }