1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

ldb-samba:ldif_handlers: dn_link_comparison correctly sorts deleted objects

This changes the behaviour of the DN syntax .comparison_fn when being
used in a search, if the search key is a deleted DN.

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 16:53:03 +12:00 committed by Andrew Bartlett
parent 11d5a80932
commit 7035659256

View File

@ -1166,10 +1166,17 @@ static int samba_ldb_dn_link_comparison(struct ldb_context *ldb, void *mem_ctx,
* They never match in an equality
*/
if (dsdb_dn_is_deleted_val(v1)) {
return 1;
}
if (dsdb_dn_is_deleted_val(v2)) {
if (! dsdb_dn_is_deleted_val(v2)) {
return 1;
}
/*
* They are both deleted!
*
* The soundest thing to do at this point is carry on
* and compare the DNs normally. This matches the
* behaviour of samba_dn_extended_match() below.
*/
} else if (dsdb_dn_is_deleted_val(v2)) {
return -1;
}