]> git.ipfire.org Git - thirdparty/samba.git/commit
ldb: add ldb_set_utf8_functions() for setting casefold functions
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 16 May 2024 23:34:35 +0000 (11:34 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 22 May 2024 23:12:32 +0000 (23:12 +0000)
commitae7ca36830be7823dde17bcaeae74b5f46b1aa3d
tree2365a48402108afb2844376b11522a8af25f1606
parent1624ac7a9876b4b8779364542747f66f5832a709
ldb: add ldb_set_utf8_functions() for setting casefold functions

This replaces ldb_set_utf8_fns(), which will be deprecated really soon.

The reason for this, as shown in surrounding commits, is that without
an explicit case-insensitive comparison we need to rely on the casefold,
and if the casefold can fail (because, e.g. bad utf-8) the comparison
ends up being a bit chaotic. The strings being compared are generally
user controlled, and a malicious user might find ways of hiding values
or perhaps fooling a binary search.

A case-insensitive comparisons that works gradually through the string
without an all-at-once casefold is better placed to deal with problems
where they happen, and we are able to separately specialise for the
ASCII case (used by SSSD) and the UTF-8 case (Samba).

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/ABI/ldb-2.10.0.sigs
lib/ldb/common/ldb_utf8.c
lib/ldb/include/ldb.h