s4:rpcsrv:dnsserver: make dns_name_compare transitive with NULLs
commit7be535315a5eed5d5b7eaea025ecf9f55e772e8e
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Mon, 8 Apr 2024 10:54:49 +0000 (8 22:54 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 23 Apr 2024 01:33:29 +0000 (23 01:33 +0000)
tree09576042a54a0d6213ed2d99c1497666bc448eff
parent31c322874b8b65518cec945e05a42fd014e6390b
s4:rpcsrv:dnsserver: make dns_name_compare transitive with NULLs

Returning 0 on `(name1 == NULL || name2 == NULL)` made NULL equal to
everything, which confuses a sort (consider {A, B, NULL} where A > B,
but A == NULL == B).

The only caller is dnsserver_enumerate_records() which fails if it
finds a NULL in the sorted list. We make the happen more quickly by
sorting NULLs to the front.

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>
source4/rpc_server/dnsserver/dnsdata.c