From 9fc36e9058984600762fa4e708a0688587fa3aba Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 12 Jul 2016 13:42:55 +0200 Subject: [PATCH] Don't validate internal or out-of-band names Closes #4149 Closes #4156 Closes #4157 --- pdns/pdns_recursor.cc | 5 +++-- pdns/syncres.cc | 7 +++++-- pdns/syncres.hh | 6 ++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index af9d057ba..f054a54d1 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -709,6 +709,7 @@ void startDoResolve(void *p) bool tracedQuery=false; // we could consider letting Lua know about this too bool variableAnswer = false; + bool shouldNotValidate = false; int res; DNSFilterEngine::Policy dfepol; @@ -787,10 +788,10 @@ void startDoResolve(void *p) break; } - if(!t_pdl->get() || !(*t_pdl)->preresolve(dc->d_remote, dc->d_local, dc->d_mdp.d_qname, QType(dc->d_mdp.d_qtype), dc->d_tcp, ret, dc->d_ednsOpts.empty() ? 0 : &dc->d_ednsOpts, dc->d_tag, &appliedPolicy, &dc->d_policyTags, res, &variableAnswer)) { try { res = sr.beginResolve(dc->d_mdp.d_qname, QType(dc->d_mdp.d_qtype), dc->d_mdp.d_qclass, ret); + shouldNotValidate = sr.wasOutOfBand(); } catch(ImmediateServFailException &e) { if(g_logCommonErrors) @@ -888,7 +889,7 @@ void startDoResolve(void *p) pw.getHeader()->rcode=res; // Does the validation mode or query demand validation? - if(g_dnssecmode == DNSSECMode::ValidateAll || g_dnssecmode==DNSSECMode::ValidateForLog || ((dc->d_mdp.d_header.ad || DNSSECOK) && g_dnssecmode==DNSSECMode::Process)) { + if(!shouldNotValidate && (g_dnssecmode == DNSSECMode::ValidateAll || g_dnssecmode==DNSSECMode::ValidateForLog || ((dc->d_mdp.d_header.ad || DNSSECOK) && g_dnssecmode==DNSSECMode::Process))) { try { if(sr.doLog()) { L<d_mdp.d_qname<<" for "<d_remote.toStringWithPort()<(DNSRecordContent::mastermake(QType::A, 1, "127.0.0.1")); ret.push_back(dr); + d_wasOutOfBand=true; return 0; } @@ -165,6 +167,7 @@ int SyncRes::beginResolve(const DNSName &qname, const QType &qtype, uint16_t qcl dr.d_content=shared_ptr(DNSRecordContent::mastermake(QType::TXT, 3, "\""+s_serverID+"\"")); ret.push_back(dr); + d_wasOutOfBand=true; return 0; } @@ -420,7 +423,7 @@ int SyncRes::doResolve(const DNSName &qname, const QType &qtype, vector& servers = iter->second.d_servers; if(servers.empty()) { ret.clear(); - doOOBResolve(qname, qtype, ret, depth, res); + d_wasOutOfBand = doOOBResolve(qname, qtype, ret, depth, res); return res; } else { @@ -982,7 +985,7 @@ int SyncRes::doResolveAt(NsSet &nameservers, DNSName auth, bool flawedNSSet, con LWResult lwr; if(tns->empty() && nameservers[*tns].first.empty() ) { LOG(prefix<& srcmask, LWResult* res); static void doEDNSDumpAndClose(int fd); @@ -340,6 +345,7 @@ public: bool d_doDNSSEC; bool d_wasVariable{false}; + bool d_wasOutOfBand{false}; typedef multi_index_container < NegCacheEntry, -- 2.40.0