|
|
dc8c34 |
From 59d71e56a68c2fb6a52875767d0665dd76a78181 Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Noriko Hosoi <nhosoi@totoro.usersys.redhat.com>
|
|
|
dc8c34 |
Date: Thu, 31 Jan 2013 16:45:28 -0800
|
|
|
dc8c34 |
Subject: [PATCH 87/99] Ticket #543 - Sorting with attributes in ldapsearch
|
|
|
dc8c34 |
gives incorrect result
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Bug description: In the server side sorting compare function
|
|
|
dc8c34 |
compare_entries_sv, if multiple attribute types are specified,
|
|
|
dc8c34 |
the sort spec for each attribute is scanned one by one in the
|
|
|
dc8c34 |
for loop. In the for loop, instead of using the "current"
|
|
|
dc8c34 |
spec, the first spec is kept using. If the attribute types
|
|
|
dc8c34 |
have different syntaxes (e.g., cis, tel), then the first
|
|
|
dc8c34 |
syntax is unexpectedly selected for the second syntax.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Fix description: This patch correctly uses the current spec
|
|
|
dc8c34 |
in the for loop.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by Nathan (Thank you!!)
|
|
|
dc8c34 |
(cherry picked from commit 95f425da43b380163c2ddae66fc77d2b863a00e5)
|
|
|
dc8c34 |
(cherry picked from commit 855d2890bc57482d7c22c6821a15b74f8053dc29)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/slapd/back-ldbm/sort.c | 12 ++++++------
|
|
|
dc8c34 |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/back-ldbm/sort.c b/ldap/servers/slapd/back-ldbm/sort.c
|
|
|
dc8c34 |
index 7768737..4164147 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/back-ldbm/sort.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/back-ldbm/sort.c
|
|
|
dc8c34 |
@@ -552,7 +552,7 @@ static int compare_entries_sv(ID *id_a, ID *id_b, sort_spec *s,baggage_carrier *
|
|
|
dc8c34 |
* doesn't try to free them. We need to note at the right place that
|
|
|
dc8c34 |
* we're on the matchrule path, and accordingly free the keys---this turns out
|
|
|
dc8c34 |
* to be when we free the indexer */
|
|
|
dc8c34 |
- if (NULL == s->matchrule) {
|
|
|
dc8c34 |
+ if (NULL == this_one->matchrule) {
|
|
|
dc8c34 |
/* Non-match rule case */
|
|
|
dc8c34 |
valuearray_get_bervalarray(valueset_get_valuearray(&attr_a->a_present_values),&value_a);
|
|
|
dc8c34 |
valuearray_get_bervalarray(valueset_get_valuearray(&attr_b->a_present_values),&value_b);
|
|
|
dc8c34 |
@@ -564,22 +564,22 @@ static int compare_entries_sv(ID *id_a, ID *id_b, sort_spec *s,baggage_carrier *
|
|
|
dc8c34 |
|
|
|
dc8c34 |
valuearray_get_bervalarray(valueset_get_valuearray(&attr_a->a_present_values),&actual_value_a);
|
|
|
dc8c34 |
valuearray_get_bervalarray(valueset_get_valuearray(&attr_b->a_present_values),&actual_value_b);
|
|
|
dc8c34 |
- matchrule_values_to_keys(s->mr_pb,actual_value_a,&temp_value);
|
|
|
dc8c34 |
+ matchrule_values_to_keys(this_one->mr_pb,actual_value_a,&temp_value);
|
|
|
dc8c34 |
/* Now copy it, so the second call doesn't crap on it */
|
|
|
dc8c34 |
value_a = slapi_ch_bvecdup(temp_value); /* Really, we'd prefer to not call the chXXX variant...*/
|
|
|
dc8c34 |
- matchrule_values_to_keys(s->mr_pb,actual_value_b,&value_b);
|
|
|
dc8c34 |
+ matchrule_values_to_keys(this_one->mr_pb,actual_value_b,&value_b);
|
|
|
dc8c34 |
if (actual_value_a) ber_bvecfree(actual_value_a);
|
|
|
dc8c34 |
if (actual_value_b) ber_bvecfree(actual_value_b);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
/* Compare them */
|
|
|
dc8c34 |
if (!order) {
|
|
|
dc8c34 |
- result = sort_attr_compare(value_a, value_b, s->compare_fn);
|
|
|
dc8c34 |
+ result = sort_attr_compare(value_a, value_b, this_one->compare_fn);
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
/* If reverse, invert the sense of the comparison */
|
|
|
dc8c34 |
- result = sort_attr_compare(value_b, value_a, s->compare_fn);
|
|
|
dc8c34 |
+ result = sort_attr_compare(value_b, value_a, this_one->compare_fn);
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
/* Time to free up the attributes allocated above */
|
|
|
dc8c34 |
- if (NULL != s->matchrule) {
|
|
|
dc8c34 |
+ if (NULL != this_one->matchrule) {
|
|
|
dc8c34 |
ber_bvecfree(value_a);
|
|
|
dc8c34 |
} else {
|
|
|
dc8c34 |
ber_bvecfree(value_a);
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.8.1.4
|
|
|
dc8c34 |
|