ldb:attrib_handlers: make ldb_comparison_Boolean more consistent
commita75c98ad688415aec8afc617a759ba90cfd9f23b
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 9 Apr 2024 22:54:41 +0000 (10 10:54 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 23 Apr 2024 01:33:29 +0000 (23 01:33 +0000)
treef3f9cae189bec8dd1ed21f062b13ccde86b05654
parent7280c8e53f463108fe3de443ce63572dde689a30
ldb:attrib_handlers: make ldb_comparison_Boolean more consistent

This isn't supposed to be used for sorting, but it is hard to say it
won't be, so we might as well make it sort properly.

Following long-standing behaviour, we try to sort "FALSE" > "TRUE", by
length, then switch to using strncasecmp().

strncasecmp would sort the other way, so we swap the operands. This is
to make e.g. "TRUE\0" sort the same as "TRUE".

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15625

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/common/attrib_handlers.c