From: Peter van Dijk Date: Fri, 19 Oct 2012 07:09:13 +0000 (+0000) Subject: add bind presigned tests and fixes for them; most fixes by Kees Monshouwer X-Git-Tag: auth-3.2-rc1~67 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b563f71b3352b62f4fc3c8f25638be54c8e01f25;p=pdns add bind presigned tests and fixes for them; most fixes by Kees Monshouwer git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2815 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/backends/bind/bindbackend2.cc b/pdns/backends/bind/bindbackend2.cc index adafd5792..5e95595fd 100644 --- a/pdns/backends/bind/bindbackend2.cc +++ b/pdns/backends/bind/bindbackend2.cc @@ -441,6 +441,7 @@ void Bind2Backend::insert(shared_ptr stage, int id, const string &qnameu, bdr.qtype=qtype.getCode(); bdr.content=content; bdr.nsec3hash = hashed; + // cerr<<"qname '"< stage, int id, bool nse uint32_t maxent = ::arg().asNum("max-ent-entries"); BOOST_FOREACH(const Bind2DNSRecord& bdr, *bb2.d_records) - if (bdr.auth) + if (bdr.auth && (bdr.qtype != QType::RRSIG)) qnames.insert(labelReverse(bdr.qname)); BOOST_FOREACH(const string& qname, qnames) @@ -646,7 +647,7 @@ void Bind2Backend::doEmptyNonTerminals(shared_ptr stage, int id, bool nse } DNSResourceRecord rr; - rr.qtype="0"; + rr.qtype="#0"; rr.content=""; rr.ttl=0; rr.priority=0; @@ -752,8 +753,12 @@ void Bind2Backend::loadConfig(string* status) DNSResourceRecord rr; string hashed; while(zpt.get(rr)) { - if(nsec3zone) - hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname))); + if(nsec3zone) { + if(rr.qtype.getCode() != QType::NSEC3 && rr.qtype.getCode() != QType::RRSIG) + hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname))); + else + hashed=""; + } insert(staging, bbd->d_id, rr.qname, rr.qtype, rr.content, rr.ttl, rr.priority, hashed); } @@ -875,8 +880,12 @@ void Bind2Backend::queueReload(BB2DomainInfo *bbd) NSEC3PARAMRecordContent ns3pr; bool nsec3zone=getNSEC3PARAM(bbd->d_name, &ns3pr); while(zpt.get(rr)) { - if(nsec3zone) - hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname))); + if(nsec3zone) { + if(rr.qtype.getCode() != QType::NSEC3 && rr.qtype.getCode() != QType::RRSIG) + hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, rr.qname))); + else + hashed=""; + } insert(staging, bbd->d_id, rr.qname, rr.qtype, rr.content, rr.ttl, rr.priority, hashed); } // cerr<<"Start sort of "<id_zone_map[bbd->d_id].d_records->size()<<" records"<auth)) + while(iter == hashindex.end() || !(iter->auth) || iter->nsec3hash.empty()) { iter--; if(iter == hashindex.begin()) @@ -1000,7 +1009,7 @@ bool Bind2Backend::getBeforeAndAfterNamesAbsolute(uint32_t id, const std::string iter = hashindex.begin(); } - while(!(iter->auth)) + while(!(iter->auth) || iter->nsec3hash.empty()) { iter++; if(iter == hashindex.end()) @@ -1030,8 +1039,9 @@ void Bind2Backend::lookup(const QType &qtype, const string &qname, DNSPacket *pk shared_ptr state = s_state; name_id_map_t::const_iterator iditer; - while((iditer=state->name_id_map.find(domain)) == state->name_id_map.end() && chopOff(domain)) - ; + do { + iditer=state->name_id_map.find(domain); + } while ((iditer == state->name_id_map.end() || (zoneId != iditer->second && zoneId != -1)) && chopOff(domain)); if(iditer==state->name_id_map.end()) { if(mustlog) diff --git a/pdns/dbdnsseckeeper.cc b/pdns/dbdnsseckeeper.cc index 040728757..d6611837b 100644 --- a/pdns/dbdnsseckeeper.cc +++ b/pdns/dbdnsseckeeper.cc @@ -358,7 +358,13 @@ bool DNSSECKeeper::getPreRRSIGs(DNSBackend& db, const std::string& signer, const DNSPacketWriter::Place signPlace, vector& rrsigs, uint32_t signTTL) { // cerr<<"Doing DB lookup for precomputed RRSIGs for '"<<(wildcardname.empty() ? qname : wildcardname)<<"'"< named-slave.conf + + for zone in $(grep zone named.conf | cut -f2 -d\") + do + rm -rf $zone-slave + done + + rm -f dnssec-slave.sqlite3 + ../pdns/pdnssec --config-dir=. create-bind-db dnssec-slave.sqlite3 + port=$((port+100)) + + $RUNWRAPPER ../pdns/pdns_server --daemon=no --local-port=$port --socket-dir=./ \ + --no-shuffle --launch=bind --bind-config=./named-slave.conf --slave \ + --send-root-referral --retrieval-threads=1 --config-name=bind-slave \ + --cache-ttl=0 --no-config --bind-dnssec-db=./dnssec-slave.sqlite3 & + echo 'waiting for zones to be loaded' + bindwait bind-slave + echo 'reloading zones to work around metadata bug' + for zone in $(grep zone named.conf | cut -f2 -d\") + do + ../pdns/pdns_control --no-config --socket-dir=. --config-name=bind-slave bind-reload-now $zone + done + fi fi ## TODO: give pdns a few seconds to startup or fail, then check if it did not fail