ldb:attrib_handlers: use ldb_ascii_toupper() in first loop
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 11 Apr 2024 01:46:28 +0000 (13:46 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 23 Apr 2024 01:33:29 +0000 (01:33 +0000)
In a dotless-I locale, we might meet an 'i' before we meet a byte with
the high bit set, in which case we still want the ldb casefold
comparison.

Many ldb operations will do some case-folding before getting here, so
hitting this might be quite rare even in those locales.

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/common/attrib_handlers.c
selftest/knownfail.d/ldb.python.api.tr [deleted file]

index c01477331f00cc9e54dcc98493d70f68346b9753..6ae12c88eec186c4d25323a51a1bc5e6d072a612 100644 (file)
@@ -351,8 +351,9 @@ int ldb_comparison_fold(struct ldb_context *ldb, void *mem_ctx,
                 * never appear in multibyte sequences */
                if (((unsigned char)s1[0]) & 0x80) goto utf8str;
                if (((unsigned char)s2[0]) & 0x80) goto utf8str;
-               if (toupper((unsigned char)*s1) != toupper((unsigned char)*s2))
+               if (ldb_ascii_toupper(*s1) != ldb_ascii_toupper(*s2)) {
                        break;
+               }
                if (*s1 == ' ') {
                        while (n1 > 1 && s1[0] == s1[1]) { s1++; n1--; }
                        while (n2 > 1 && s2[0] == s2[1]) { s2++; n2--; }
diff --git a/selftest/knownfail.d/ldb.python.api.tr b/selftest/knownfail.d/ldb.python.api.tr
deleted file mode 100644 (file)
index f327762..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-^ldb.python.api.tr.api.SearchTests.test_subtree_uniquer_elsewhere.none
-^ldb.python.api.tr.api.SearchTestsLmdb.test_subtree_uniquer_elsewhere.none