From fce41660df8cfbedfaa14520184c8da01744978f Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 3 Dec 2009 04:38:28 +0000 Subject: [PATCH] 2593. [bug] Improve a corner source of SERVFAILs [RT #19632] --- CHANGES | 2 ++ bin/named/query.c | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CHANGES b/CHANGES index d24d3f7790..121ada4946 100644 --- a/CHANGES +++ b/CHANGES @@ -241,6 +241,8 @@ 2601. [doc] Mention file creation mode mask in the named manual page. +2593. [bug] Improve a corner source of SERVFAILs [RT #19632] + 2589. [bug] dns_db_unregister() failed to clear '*dbimp'. [RT #19626] diff --git a/bin/named/query.c b/bin/named/query.c index a35ec1784f..4877d8fcb6 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.313.20.14 2009/11/25 02:25:56 marka Exp $ */ +/* $Id: query.c,v 1.313.20.15 2009/12/03 04:38:28 marka Exp $ */ /*! \file */ @@ -3318,6 +3318,14 @@ do { \ line = __LINE__; \ } while (0) +#define RECURSE_ERROR(r) \ +do { \ + if ((r) == DNS_R_DUPLICATE || (r) == DNS_R_DROP) \ + QUERY_ERROR(r); \ + else \ + QUERY_ERROR(DNS_R_SERVFAIL); \ +} while (0) + /* * Extract a network address from the RDATA of an A or AAAA * record. @@ -4042,14 +4050,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) if (result == ISC_R_SUCCESS) client->query.attributes |= NS_QUERYATTR_RECURSING; - else if (result == DNS_R_DUPLICATE || - result == DNS_R_DROP) { - /* Duplicate query. */ - QUERY_ERROR(result); - } else { - /* Unable to recurse. */ - QUERY_ERROR(DNS_R_SERVFAIL); - } + else + RECURSE_ERROR(result); goto cleanup; } else { /* Unable to give root server referral. */ @@ -4228,11 +4230,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) if (result == ISC_R_SUCCESS) client->query.attributes |= NS_QUERYATTR_RECURSING; - else if (result == DNS_R_DUPLICATE || - result == DNS_R_DROP) - QUERY_ERROR(result); else - QUERY_ERROR(DNS_R_SERVFAIL); + RECURSE_ERROR(result); } else { dns_fixedname_t fixed; @@ -4772,7 +4771,8 @@ query_find(ns_client_t *client, dns_fetchevent_t *event, dns_rdatatype_t qtype) client->query.attributes |= NS_QUERYATTR_RECURSING; else - QUERY_ERROR(DNS_R_SERVFAIL); } + RECURSE_ERROR(result); + } goto addauth; } /*