From: Kees Monshouwer Date: Fri, 30 Mar 2018 14:57:43 +0000 (+0200) Subject: auth: avoid an isane amount of new backend connections during an AXFR X-Git-Tag: dnsdist-1.3.1~177^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F6427%2Fhead;p=thirdparty%2Fpdns.git auth: avoid an isane amount of new backend connections during an AXFR --- diff --git a/pdns/signingpipe.cc b/pdns/signingpipe.cc index 44e246cbe4..6c98dd54c6 100644 --- a/pdns/signingpipe.cc +++ b/pdns/signingpipe.cc @@ -270,8 +270,8 @@ unsigned int ChunkedSigningPipe::getReady() const void ChunkedSigningPipe::worker(int fd) try { - DNSSECKeeper dk; UeberBackend db("key-only"); + DNSSECKeeper dk(&db); chunk_t* chunk = nullptr; int res; diff --git a/pdns/tcpreceiver.cc b/pdns/tcpreceiver.cc index 409b095588..e1dfd2e55f 100644 --- a/pdns/tcpreceiver.cc +++ b/pdns/tcpreceiver.cc @@ -439,7 +439,7 @@ bool TCPNameserver::canDoAXFR(shared_ptr q) } } - DNSSECKeeper dk; + DNSSECKeeper dk(s_P->getBackend()); if (q->d_tsig_algo == TSIG_GSS) { vector princs; @@ -584,6 +584,7 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr q, int ou s_P=new PacketHandler; } + // canDoAXFR does all the ACL checks, and has the if(disable-axfr) shortcut, call it first. if (!canDoAXFR(q)) { g_log<getRemote()<<" may not request AXFR"<setRcode(RCode::NotAuth); @@ -591,7 +592,6 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr q, int ou return 0; } - // canDoAXFR does all the ACL checks, and has the if(disable-axfr) shortcut, call it first. if(!s_P->getBackend()->getSOAUncached(target, sd)) { g_log<setRcode(RCode::NotAuth); @@ -608,7 +608,7 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr q, int ou return 0; } - DNSSECKeeper dk; + DNSSECKeeper dk(&db); dk.clearCaches(target); bool securedZone = dk.isSecuredZone(target); bool presignedZone = dk.isPresigned(target); @@ -645,8 +645,7 @@ int TCPNameserver::doAXFR(const DNSName &target, shared_ptr q, int ou if (algorithm == DNSName("hmac-md5.sig-alg.reg.int")) algorithm = DNSName("hmac-md5"); if (algorithm != DNSName("gss-tsig")) { - Lock l(&s_plock); - if(!s_P->getBackend()->getTSIGKey(tsigkeyname, &algorithm, &tsig64)) { + if(!db.getTSIGKey(tsigkeyname, &algorithm, &tsig64)) { g_log< q, int ou } - UeberBackend signatureDB; - // SOA *must* go out first, our signing pipe might reorder DLOG(g_log<<"Sending out SOA"< q, int ou if(securedZone && !presignedZone) { set authSet; authSet.insert(target); - addRRSigs(dk, signatureDB, authSet, outpacket->getRRS()); + addRRSigs(dk, db, authSet, outpacket->getRRS()); } if(haveTSIGDetails && !tsigkeyname.empty())