Length comparison of the linearized version is not correct.
authorSimo Sorce <idra@samba.org>
Wed, 29 Oct 2008 12:34:05 +0000 (08:34 -0400)
committerSimo Sorce <idra@samba.org>
Wed, 29 Oct 2008 22:07:29 +0000 (18:07 -0400)
The linearized version is not casefolded so length might not match
and yet the strings be equivalent. This can happen if one component
is case-insensitive and a letter that have an uppercase version of
a multibyte character that differ in legth from the corresponding
lowercase one.

source4/lib/ldb/common/ldb_dn.c

index e36aea4e697fd8b2dddf5bdfdcaad64d18aa7c2a..5e6fb96457f0a3364a05f2e3e1962113cfdeb14d 100644 (file)
@@ -749,9 +749,6 @@ int ldb_dn_compare_base(struct ldb_dn *base, struct ldb_dn *dn)
                if (base->linearized && dn->linearized) {
                        /* try with a normal compare first, if we are lucky
                         * we will avoid exploding and casfolding */
                if (base->linearized && dn->linearized) {
                        /* try with a normal compare first, if we are lucky
                         * we will avoid exploding and casfolding */
-                       int dif;
-                       dif = strlen(dn->linearized) - strlen(base->linearized);
-                       if (dif < 0) return dif;
                        if (strcmp(base->linearized, &dn->linearized[dif]) == 0) return 0;
                }
 
                        if (strcmp(base->linearized, &dn->linearized[dif]) == 0) return 0;
                }