bind9/tests/dns
Evan Hunt 2dff926624 yet another fix_iterator() bug
under some circumstances it was possible for the iterator to
be set to the first leaf in a set of twigs, when it should have
been set to the last.

a unit test has been added to test this scenario. if there is a
a tree containing the following values: {".", "abb.", "abc."}, and
we query for "acb.", previously the iterator would be positioned at
"abb." instead of "abc.".

the tree structure is:
    branch (offset 1, ".")
      branch (offset 3, ".ab")
        leaf (".abb")
        leaf (".abc")

we find the branch with offset 3 (indicating that its twigs differ
from each other in the third position of the label, "abB" vs "abC").
but the search key differs from the found keys at position 2
("aC" vs "aB").  we look up the bit value in position 3 of the
search key ("B"), and incorrectly follow it onto the wrong twig
("abB").

to correct for this, we need to check for the case where the search
key is greater than the found key in a position earlier than the
branch offset. if it is, then we need to pop from the current leaf
to its parent, and get the greatest leaf from there.

a further change is needed to ensure that we don't do this twice;
when we've moved to a new leaf and the point of difference between
it and the search key even earlier than before, then we're definitely
at a predecessor node and there's no need to continue the loop.
2024-04-25 10:29:07 -07:00
..
comparekeys Remove TKEY Mode 2 (Diffie-Hellman) 2023-03-08 08:36:25 +01:00
testdata Update "dns" unit test's test data .gitignore file 2022-08-09 08:19:51 +00:00
testkeys Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
.gitignore Add tests/dns/badcache.out to .gitignore 2023-10-27 12:55:51 +02:00
acl_test.c Refactor dns_{acl,aclenv}_create to return void 2023-10-13 14:44:40 +02:00
badcache_test.c remove dns_name_fromstring2() 2023-08-31 10:29:16 -07:00
db_test.c add a compile-time option to select default zone and cache DB 2024-03-06 10:49:02 +01:00
dbdiff_test.c Include <inttypes.h> whenever including <cmocka.h> 2023-05-18 15:12:23 +02:00
dbiterator_test.c make the qpzone database dumpable 2024-03-08 15:36:56 -08:00
dbversion_test.c add a compile-time option to select default zone and cache DB 2024-03-06 10:49:02 +01:00
dispatch_test.c dispatch_test: use the NM tests timeouts 2024-04-15 16:33:24 +03:00
dns64_test.c Include <inttypes.h> whenever including <cmocka.h> 2023-05-18 15:12:23 +02:00
dnstap_test.c remove dns_name_towire2() 2023-08-31 10:29:16 -07:00
dst_test.c Include <inttypes.h> whenever including <cmocka.h> 2023-05-18 15:12:23 +02:00
geoip_test.c Include <inttypes.h> whenever including <cmocka.h> 2023-05-18 15:12:23 +02:00
Kdh.+002+18602.key Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
keytable_test.c Attach to the dns_dispatchmgr in the dns_view object 2023-08-15 10:25:37 -07:00
Krsa.+008+29238.key Check if RSASHA1 is supported by the OS 2022-08-09 16:22:19 +02:00
Makefile.am add qpzone_test unit test 2024-03-08 15:36:56 -08:00
master_test.c add a compile-time option to select default zone and cache DB 2024-03-06 10:49:02 +01:00
mkraw.pl Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
name_test.c Extract empty name in 'source' into 'name' 2024-04-24 01:38:14 +00:00
nametree_test.c unconditionally create view and resolver nametrees 2023-09-04 10:19:48 +02:00
nsec3_test.c Change max NSEC3 iterations in unit tests to 50 2023-12-05 14:58:58 +00:00
nsec3param_test.c Include <inttypes.h> whenever including <cmocka.h> 2023-05-18 15:12:23 +02:00
private_test.c Update clang to version 14 2022-06-16 17:21:11 +02:00
qp_test.c yet another fix_iterator() bug 2024-04-25 10:29:07 -07:00
qpdb_test.c rename qpdb to qpcache 2024-03-08 15:36:56 -08:00
qpmulti_test.c Improve qp-trie leaf return values 2023-08-15 14:24:39 +02:00
qpzone_test.c rename qpdb to qpcache 2024-03-08 15:36:56 -08:00
rbt_test.c clean up dns_rbt 2024-02-14 01:36:44 -08:00
rdata_test.c Add RESINFO record type 2024-02-26 12:02:40 +11:00
rdataset_test.c Include <inttypes.h> whenever including <cmocka.h> 2023-05-18 15:12:23 +02:00
rdatasetstats_test.c Refactor isc_stats_create() and its downstream users to return void 2023-07-27 11:37:44 +02:00
resolver_test.c Make dns_dispatch bound to threads 2023-09-16 07:32:17 +02:00
rsa_test.c Include <inttypes.h> whenever including <cmocka.h> 2023-05-18 15:12:23 +02:00
sigs_test.c Refactor findzonekeys 2024-01-25 14:48:07 +01:00
time_test.c Move all the unit tests to /tests/<libname>/ 2022-05-28 14:53:02 -07:00
tsig_test.c Change dns_message_create() function to accept memory pools 2023-09-24 18:07:40 +02:00
update_test.c Remove isc_stdtime_get() macro 2023-03-31 13:33:16 +02:00
zonemgr_test.c use a thread-local variable to get the current running loop 2024-04-02 10:35:56 +02:00
zt_test.c Add dns_view_apply 2023-06-01 16:51:38 +02:00