If neither dn can casefold, they should be considered equal. Otherwise
cmp(dn1, dn2) will be inconsistent with cmp(dn2, dn1).
These will still sort to the end of the list, relative to any valid
DNs.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
}
if (( ! dn0->valid_case) || ( ! dn1->valid_case)) {
+ bool ok0, ok1;
if (dn0->linearized && dn1->linearized) {
/* try with a normal compare first, if we are lucky
* we will avoid exploding and casefolding */
return 0;
}
}
-
- if ( ! ldb_dn_casefold_internal(dn0)) {
+ /*
+ * If a DN can't casefold, it goes to the end.
+ */
+ ok0 = ldb_dn_casefold_internal(dn0);
+ ok1 = ldb_dn_casefold_internal(dn1);
+ if (! ok0) {
+ if (! ok1) {
+ return 0;
+ }
return 1;
}
-
- if ( ! ldb_dn_casefold_internal(dn1)) {
+ if (! ok1) {
return -1;
}
-
}
/*