bind9/lib/ns
Ondřej Surý f7cd00f1ef Fix swapped arguments in redirect2() single-label branch
For a query whose qname is the root, the labels==1 branch in
redirect2() called dns_name_copy(redirectname, view->redirectzone)
with arguments reversed, overwriting the view-global
nxdomain-redirect target with the empty redirectname rather than
copying the configured target into the per-query lookup name.  After
the corruption, view->redirectzone names the root, so
dns_name_issubdomain() makes redirect2() short-circuit for every
subsequent query and the nxdomain-redirect feature stops working
until named is restarted.

Triggering this needs the resolver to receive an NXDOMAIN for the
root from upstream, which does not happen in normal DNS operation.

Swap the arguments to match the dns_name_copy(source, dest)
signature.  Add a system test that issues a root query through the
nxdomain-redirect resolver and verifies the redirect feature still
works for a normal NXDOMAIN-producing query afterwards.

Assisted-by: Claude:claude-opus-4-7
(cherry picked from commit c62f24f7ee)
2026-04-30 07:08:47 +02:00
..
include Use clang-format-22 to update formatting 2026-03-04 12:24:53 +01:00
client.c Use clang-format-20 to update formatting 2025-06-25 13:59:44 +10:00
hooks.c standardize CHECK and RETERR macros 2025-12-03 19:18:12 -08:00
interfacemgr.c Remove --with-tuning=small/large configuration option 2025-01-22 14:16:40 +01:00
listenlist.c Remove redundant parentheses from the return statement 2024-11-19 16:06:16 +01:00
log.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
Makefile.am Move all the unit tests to /tests/<libname>/ 2022-05-31 12:06:00 +02:00
notify.c Update the copyright information in all files in the repository 2022-01-11 09:05:02 +01:00
query.c Fix swapped arguments in redirect2() single-label branch 2026-04-30 07:08:47 +02:00
server.c Remove redundant parentheses from the return statement 2024-11-19 16:06:16 +01:00
sortlist.c Remove redundant parentheses from the return statement 2024-11-19 16:06:16 +01:00
stats.c Remove redundant parentheses from the return statement 2024-11-19 16:06:16 +01:00
tests Move all the unit tests to /tests/<libname>/ 2022-05-31 12:06:00 +02:00
update.c Refuse SIG and NXT records in dynamic updates 2026-04-20 11:21:14 +02:00
xfrout.c standardize CHECK and RETERR macros 2025-12-03 19:18:12 -08:00