]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
improve case insensitivity of packetcache cleaning, plus silence coverity warning...
authorbert hubert <bert.hubert@netherlabs.nl>
Fri, 4 Apr 2014 05:42:16 +0000 (07:42 +0200)
committerbert hubert <bert.hubert@netherlabs.nl>
Fri, 4 Apr 2014 05:42:16 +0000 (07:42 +0200)
pdns/dns.cc
pdns/recpacketcache.cc

index f726241bd4e892936d7f67b81aac52592c6c614d..34999b550a171dc585b42ff960438c95ec383765 100644 (file)
@@ -101,7 +101,7 @@ bool dnspacketLessThan(const std::string& a, const std::string& b)
     int result=0;
     unsigned int n;
     for(n = 0; n < aLabelLen && n < bLabelLen; ++n) 
-      if((result = aSafe[aPos + n] - bSafe[bPos +n]))
+      if((result = aSafe[aPos + n] - bSafe[bPos +n]))   // XXX this should perhaps be dns_tolower
         break;
     // cerr<<"Done loop, result="<<result<<", n = "<<n<<", aLabelLen="<<aLabelLen<<", bLabelLen="<<bLabelLen<<endl;
     if(result < 0)
index 6b3957587ae8e19d6fee4e7c02afc8d2580210bb..d5c3ac41268ed477941478b46110c11b3a3d3d94 100644 (file)
@@ -15,10 +15,10 @@ RecursorPacketCache::RecursorPacketCache()
 int RecursorPacketCache::doWipePacketCache(const string& name, uint16_t qtype)
 {
   vector<uint8_t> packet;
-  DNSPacketWriter pw(packet, name, 0);
+  DNSPacketWriter pw(packet, toLower(name), 0);
   pw.getHeader()->rd=1;
   Entry e;
-  e.d_packet.assign(&*packet.begin(), &*packet.end());
+  e.d_packet.assign((const char*)&*packet.begin(), packet.size());
 
   // so the idea is, we search for a packet with qtype=0, which is ahead of anything with that name
 
@@ -29,7 +29,7 @@ int RecursorPacketCache::doWipePacketCache(const string& name, uint16_t qtype)
       break;
     uint16_t t;
     string found=questionExpand(iter->d_packet.c_str(), iter->d_packet.length(), t);
-    if(found != name) {
+    if(!pdns_iequals(found, name)) {  
       break;
     }
     if(t==qtype || qtype==0xffff) {