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

ldb-samba:ldif_handlers: dn_link_comparison: sort invalid DNs

If both DNs are invalid, we can say they are equal.

This means invalid or NULL DNs will sort to the end of the array,
before deleted DNs:

[ valid DNs, sorted | invalid/NULL DNs | deleted DNs, sorted ]

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

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-04-11 18:08:54 +12:00 committed by Andrew Bartlett
parent 341b8fb60e
commit 7280c8e53f

View File

@ -1181,12 +1181,18 @@ static int samba_ldb_dn_link_comparison(struct ldb_context *ldb, void *mem_ctx,
}
dn1 = ldb_dn_from_ldb_val(mem_ctx, ldb, v1);
dn2 = ldb_dn_from_ldb_val(mem_ctx, ldb, v2);
if ( ! ldb_dn_validate(dn1)) {
TALLOC_FREE(dn1);
if ( ! ldb_dn_validate(dn2)) {
TALLOC_FREE(dn2);
return 0;
}
TALLOC_FREE(dn2);
return 1;
}
dn2 = ldb_dn_from_ldb_val(mem_ctx, ldb, v2);
if ( ! ldb_dn_validate(dn2)) {
TALLOC_FREE(dn1);
TALLOC_FREE(dn2);