bcb1e2
From 1b6590eafce064cbf70f5afc2fe4d6f1bfdc3804 Mon Sep 17 00:00:00 2001
bcb1e2
From: Mark Andrews <marka@isc.org>
bcb1e2
Date: Thu, 27 Oct 2022 13:22:11 +1100
bcb1e2
Subject: [PATCH] Move the mapping of SIG and RRSIG to ANY
bcb1e2
bcb1e2
dns_db_findext() asserts if RRSIG is passed to it and
bcb1e2
query_lookup_stale() failed to map RRSIG to ANY to prevent this.  To
bcb1e2
avoid cases like this in the future, move the mapping of SIG and RRSIG
bcb1e2
to ANY for qctx->type to qctx_init().
bcb1e2
bcb1e2
(cherry picked from commit 56eae064183488bcf7ff08c3edf59f2e1742c1b6)
bcb1e2
---
bcb1e2
 lib/ns/query.c | 17 +++++++++--------
bcb1e2
 1 file changed, 9 insertions(+), 8 deletions(-)
bcb1e2
bcb1e2
diff --git a/lib/ns/query.c b/lib/ns/query.c
bcb1e2
index a450cb7..f66bab4 100644
bcb1e2
--- a/lib/ns/query.c
bcb1e2
+++ b/lib/ns/query.c
bcb1e2
@@ -5103,6 +5103,15 @@ qctx_init(ns_client_t *client, dns_fetchevent_t **eventp, dns_rdatatype_t qtype,
bcb1e2
 	qctx->result = ISC_R_SUCCESS;
bcb1e2
 	qctx->findcoveringnsec = qctx->view->synthfromdnssec;
bcb1e2
 
bcb1e2
+	/*
bcb1e2
+	 * If it's an RRSIG or SIG query, we'll iterate the node.
bcb1e2
+	 */
bcb1e2
+	if (qctx->qtype == dns_rdatatype_rrsig ||
bcb1e2
+	    qctx->qtype == dns_rdatatype_sig)
bcb1e2
+	{
bcb1e2
+		qctx->type = dns_rdatatype_any;
bcb1e2
+	}
bcb1e2
+
bcb1e2
 	CALL_HOOK_NORETURN(NS_QUERY_QCTX_INITIALIZED, qctx);
bcb1e2
 }
bcb1e2
 
bcb1e2
@@ -5243,14 +5252,6 @@ query_setup(ns_client_t *client, dns_rdatatype_t qtype) {
bcb1e2
 
bcb1e2
 	CALL_HOOK(NS_QUERY_SETUP, &qctx);
bcb1e2
 
bcb1e2
-	/*
bcb1e2
-	 * If it's a SIG query, we'll iterate the node.
bcb1e2
-	 */
bcb1e2
-	if (qctx.qtype == dns_rdatatype_rrsig ||
bcb1e2
-	    qctx.qtype == dns_rdatatype_sig) {
bcb1e2
-		qctx.type = dns_rdatatype_any;
bcb1e2
-	}
bcb1e2
-
bcb1e2
 	/*
bcb1e2
 	 * Check SERVFAIL cache
bcb1e2
 	 */
bcb1e2
-- 
bcb1e2
2.39.1
bcb1e2