[PATCHES] Add ldb server_sort tests, and allow sort on unrequested attributes

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Tue Mar 8 22:59:01 UTC 2016

The first patch adds tests to ensure that the server_sort module is in
fact sorting ldb results. As it turns out, Unicode sorting is a tricky
thing, and Windows, Python, and the Unicode standard all do it
slightly differently. Samba's version is dismal, and will fail if you
wander too far away from ASCII alphanumerics, let alone out of ASCII
itself. Proper Unicode comparisons use multiple passes, ignoring for
example hyphens in early passes, while Samba has what amounts to a
strcasecmp that knows about case in utf-8.

So we repeat the tests twice, once with devilish tests that can
distinguish between Python, Windows, and the Unicode standard, and
again with the strings reduced to alphanumeric baby talk. The former
version is marked knownfail.

(I actually do have patches somewhere that use the ICU library to
"properly" sort attributes that use a utf-8 syntax. They seem to add
surprisingly little overhead, but they do add a dependency on a
horrendous lump of C++, and the resultant sort behaviour is not quite
the same as Windows 2012R2).

The second patch adds the ability to search for some attributes while
sorting on another. That is you could get a list of GUIDs sorted by
the corresponding CNs without actually requesting or receiving the CNs.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sort.patch
Type: text/x-diff
Size: 21793 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160309/58b6d3df/sort.diff>

More information about the samba-technical mailing list