1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

ldb-samba: use ldb_comparison_fold_utf8()

This means ldb-samba/dsdb comparisons will be case-insensitive for
non-ASCII UTF-8 characters (within the bounds of the 16-bit casefold
table). And they will remain transitive.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2024-05-16 14:09:46 +12:00 committed by Andrew Bartlett
parent 0becc8a90c
commit edabb9f4cb
7 changed files with 13 additions and 14 deletions

View File

@ -152,7 +152,7 @@ int ldb_comparison_fold_utf8(void *ignored,
ldb_set_debug(ldb, ldb_wrap_debug, NULL);
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
if (session_info) {
if (ldb_set_opaque(ldb, DSDB_SESSION_INFO, session_info)) {

View File

@ -88,7 +88,7 @@ static PyObject *py_ldb_set_utf8_casefold(PyObject *self,
ldb = pyldb_Ldb_AS_LDBCONTEXT(self);
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
Py_RETURN_NONE;
}

View File

@ -144,7 +144,7 @@ static int extensions_hook(struct ldb_context *ldb, enum ldb_module_hook_type t)
return ldb_operr(ldb);
}
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
break;
}

View File

@ -177,7 +177,7 @@ static void test_ldb_comparison_fold_default_common(void **state)
static void test_ldb_comparison_fold_utf8_common(void **state)
{
struct ldb_context *ldb = ldb_init(NULL, NULL);
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
_test_ldb_comparison_fold_set(ldb,
values_common,
ARRAY_SIZE(values_common));
@ -190,7 +190,7 @@ static void test_ldb_comparison_fold_utf8_common(void **state)
static void test_ldb_comparison_fold_utf8(void **state)
{
struct ldb_context *ldb = ldb_init(NULL, NULL);
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
_test_ldb_comparison_fold_set(ldb,
values_utf8,
ARRAY_SIZE(values_utf8));

View File

@ -1 +0,0 @@
^ldb.unittests.test_ldb_comparison_fold.test_ldb_comparison_fold_utf8\b

View File

@ -47,7 +47,7 @@ static bool torture_dsdb_dn_attrs(struct torture_context *torture)
ldb_register_samba_handlers(ldb), LDB_SUCCESS,
"Failed to register Samba handlers");
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
/* Test DN+Binary behaviour */
torture_assert(torture, syntax = ldb_samba_syntax_by_name(ldb, DSDB_SYNTAX_BINARY_DN),
@ -144,7 +144,7 @@ static bool torture_dsdb_dn_valid(struct torture_context *torture)
ldb_register_samba_handlers(ldb), LDB_SUCCESS,
"Failed to register Samba handlers");
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
/* Check behaviour of a normal DN */
torture_assert(torture,
@ -266,7 +266,7 @@ static bool torture_dsdb_dn_invalid(struct torture_context *torture)
ldb_register_samba_handlers(ldb), LDB_SUCCESS,
"Failed to register Samba handlers");
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
/* Check behaviour of a normal DN */
val = data_blob_string_const("samba,dc=org");

View File

@ -444,7 +444,7 @@ static bool torture_ldb_attrs(struct torture_context *torture)
ldb_register_samba_handlers(ldb), LDB_SUCCESS,
"Failed to register Samba handlers");
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
/* Test SID behaviour */
torture_assert(torture, attr = ldb_schema_attribute_by_name(ldb, "objectSid"),
@ -603,7 +603,7 @@ static bool torture_ldb_dn_attrs(struct torture_context *torture)
ldb_register_samba_handlers(ldb), LDB_SUCCESS,
"Failed to register Samba handlers");
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
/* Test SID behaviour */
torture_assert(torture, attr = ldb_dn_extended_syntax_by_name(ldb, "SID"),
@ -721,7 +721,7 @@ static bool torture_ldb_dn_extended(struct torture_context *torture)
ldb_register_samba_handlers(ldb), LDB_SUCCESS,
"Failed to register Samba handlers");
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
/* Check behaviour of a normal DN */
torture_assert(torture,
@ -982,7 +982,7 @@ static bool torture_ldb_dn(struct torture_context *torture)
ldb_register_samba_handlers(ldb), LDB_SUCCESS,
"Failed to register Samba handlers");
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
/* Check behaviour of a normal DN */
torture_assert(torture,
@ -1100,7 +1100,7 @@ static bool torture_ldb_dn_invalid_extended(struct torture_context *torture)
ldb_register_samba_handlers(ldb), LDB_SUCCESS,
"Failed to register Samba handlers");
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
ldb_set_utf8_functions(ldb, NULL, wrap_casefold, ldb_comparison_fold_utf8);
/* Check behaviour of a normal DN */
torture_assert(torture,