fixed server side sorting of case-insensitive strings
authorAndrew Tridgell <tridge@samba.org>
Wed, 10 Jun 2009 00:13:55 +0000 (10:13 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 10 Jun 2009 00:13:55 +0000 (10:13 +1000)
The sort module uses ldb_comparison_fold() as the comparison function
for case-insensitive attributes. In other places the function is being
used to produce a boolean, but for sorting we care about ordering.

The n1 - n2 return was sorting by length, not value

source4/lib/ldb/common/attrib_handlers.c

index 4869e3289c88e6f082d057565454ef0d0be192ad..9cb9ff886cc6a159511407bbdfc6e4d7f4a035f2 100644 (file)
@@ -216,9 +216,6 @@ int ldb_comparison_fold(struct ldb_context *ldb, void *mem_ctx,
                while (*s1 == ' ') { s1++; n1--; }
                while (*s2 == ' ') { s2++; n2--; }
        }
-       if (n1 != n2) {
-               return n1 - n2;
-       }
        return (int)(toupper(*s1)) - (int)(toupper(*s2));
 
 utf8str: