const struct ldb_val *v1, const struct ldb_val *v2)
{
const char *s1=(const char *)v1->data, *s2=(const char *)v2->data;
- char *b1, *b2, *u1, *u2;
+ const char *u1, *u2;
+ char *b1, *b2;
int ret;
while (*s1 == ' ') s1++;
while (*s2 == ' ') s2++;
utf8str:
/* no need to recheck from the start, just from the first utf8 char found */
- b1 = u1 = ldb_casefold(ldb, mem_ctx, s1);
- b2 = u2 = ldb_casefold(ldb, mem_ctx, s2);
+ b1 = ldb_casefold(ldb, mem_ctx, s1);
+ b2 = ldb_casefold(ldb, mem_ctx, s2);
- if (u1 && u2) {
+ if (b1 && b2) {
/* Both strings converted correctly */
+
+ u1 = b1;
+ u2 = b2;
} else {
/* One of the strings was not UTF8, so we have no options but to do a binary compare */
out->length = 0;
out->data = NULL;
- dn = ldb_dn_explode_casefold(ldb, mem_ctx, (char *)in->data);
- if (dn == NULL) {
+ dn = ldb_dn_new(ldb, mem_ctx, (char *)in->data);
+ if ( ! ldb_dn_validate(dn)) {
return -1;
}
- out->data = (uint8_t *)ldb_dn_linearize(mem_ctx, dn);
+ out->data = (uint8_t *)ldb_dn_alloc_linearized(mem_ctx, dn);
if (out->data == NULL) {
goto done;
}
struct ldb_dn *dn1 = NULL, *dn2 = NULL;
int ret;
- dn1 = ldb_dn_explode_casefold(ldb, mem_ctx, (char *)v1->data);
- if (dn1 == NULL) return -1;
+ dn1 = ldb_dn_new(ldb, mem_ctx, (char *)v1->data);
+ if ( ! ldb_dn_validate(dn1)) return -1;
- dn2 = ldb_dn_explode_casefold(ldb, mem_ctx, (char *)v2->data);
- if (dn2 == NULL) {
+ dn2 = ldb_dn_new(ldb, mem_ctx, (char *)v2->data);
+ if ( ! ldb_dn_validate(dn2)) {
talloc_free(dn1);
return -1;
}
- ret = ldb_dn_compare(ldb, dn1, dn2);
+ ret = ldb_dn_compare(dn1, dn2);
talloc_free(dn1);
talloc_free(dn2);