From 0df528cc9ebbb52dcfeb866bdf004ce83c155586 Mon Sep 17 00:00:00 2001 From: Ralph Dolmans Date: Wed, 3 Jan 2018 16:54:22 +0000 Subject: [PATCH] - Fix queries being leaked above stub when refetching glue. git-svn-id: file:///svn/unbound/trunk@4434 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 3 +++ iterator/iterator.c | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 16f3cacdb..2fc023834 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +3 January 2018: Ralph + - Fix queries being leaked above stub when refetching glue. + 2 January 2017: Wouter - Fix that DS queries with referral replies are answered straight away, without a repeat query picking the DS from cache. diff --git a/iterator/iterator.c b/iterator/iterator.c index d67d8eb36..c6e09be30 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -1374,16 +1374,23 @@ processInitRequest2(struct module_qstate* qstate, struct iter_qstate* iq, log_query_info(VERB_QUERY, "resolving (init part 2): ", &qstate->qinfo); + delname = iq->qchase.qname; + delnamelen = iq->qchase.qname_len; if(iq->refetch_glue) { if(!iq->dp) { log_err("internal or malloc fail: no dp for refetch"); return error_response(qstate, id, LDNS_RCODE_SERVFAIL); } - delname = iq->dp->name; - delnamelen = iq->dp->namelen; - } else { - delname = iq->qchase.qname; - delnamelen = iq->qchase.qname_len; + /* Do not send queries above stub, do not set delname to dp if + * this is above stub without stub-first. */ + struct iter_hints_stub* stub = hints_lookup_stub( + qstate->env->hints, iq->qchase.qname, iq->qchase.qclass, + iq->dp); + if(!stub || !stub->dp->has_parent_side_NS || + dname_subdomain_c(iq->dp->name, stub->dp->name)) { + delname = iq->dp->name; + delnamelen = iq->dp->namelen; + } } if(iq->qchase.qtype == LDNS_RR_TYPE_DS || iq->refetch_glue) { if(!dname_is_root(delname)) -- 2.47.3