]> granicus.if.org Git - pdns/commitdiff
after a db lookup, always finish the get cycle
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Thu, 16 Aug 2018 19:15:59 +0000 (21:15 +0200)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Fri, 17 Aug 2018 08:06:47 +0000 (10:06 +0200)
pdns/rfc2136handler.cc

index bfa0cb31b815dd0d23870a22eda29c55a39e0fe4..dafc8bdbc048a036dc3a5a4f0c7e4f958536080d 100644 (file)
@@ -961,6 +961,9 @@ int PacketHandler::processUpdate(DNSPacket *p) {
       di.backend->lookup(QType(QType::ANY), rr->d_name);
       while (di.backend->get(rec)) {
         if (rec.qtype != QType::CNAME && rec.qtype != QType::RRSIG) {
+          // leave database handle in a consistent state
+          while (di.backend->get(rec))
+            ;
           g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": Data other than CNAME exists for the same name"<<endl;
           di.backend->abortTransaction();
           return RCode::Refused;
@@ -973,6 +976,9 @@ int PacketHandler::processUpdate(DNSPacket *p) {
       di.backend->lookup(QType(QType::CNAME), rr->d_name);
       while (di.backend->get(rec)) {
         if (rec.qtype == QType::CNAME && rr->d_type != QType::RRSIG) {
+          // leave database handle in a consistent state
+          while (di.backend->get(rec))
+            ;
           g_log<<Logger::Warning<<msgPrefix<<"Refusing update for " << rr->d_name << "/" << QType(rr->d_type).getName() << ": CNAME exists for the same name"<<endl;
           di.backend->abortTransaction();
           return RCode::Refused;