[PATCHES] ldb server_sort tests and sort on non-requested attribute.

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Tue Mar 8 23:36:29 UTC 2016

The first patch adds tests for the sort module. The tests are repeated
twice: once with nasty values that can distinguish between the
comparison functions in Windows, Python, and the Unicode standard; and
again in ASCII alphanumeric baby-talk so that Samba has something to
pass. Samba's sort of utf-8 attributes is quite abysmal, amounting to
a strcasecmp that is aware of case in the first 16 bits of Unicode,
while proper Unicode collation has multiple passes where the early
passes perform a bag of tricks like ignoring hyphens and transforming
characters. The result is that Samba doesn't even sort all of ASCII
properly in attributes with utf-8 syntax.

I actually do have patches that use the ICU library to do proper utf-8
sorting, and the overhead seems surprisingly small. On the other hand,
they add a dependency on a horrendous lump of C++ and the results are
not quite the same as Windows 2012R2 (which, for example, throws its
hands up outside of the basic multilingual plane).

The second patch adds the ability to sort on an attribute other than
the ones requested in the search. So for example, you could get a list
of GUIDs sorted by the corresponding CNs without requesting or
receiving the CNs.


More information about the samba-technical mailing list