Show
Ignore:
Timestamp:
05/05/06 09:33:37 (7 years ago)
Author:
ahu
Message:

implement RFC 2181 paragraph 5.2:

Should an authoritative source send such a malformed RRSet, the
client should treat the RRs for all purposes as if all TTLs in the
RRSet had been set to the value of the lowest TTL in the RRSet.

Thanks to Stephen Harker for noticing in  http://mailman.powerdns.com/pipermail/pdns-users/2006-May/003341.html

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/syncres.cc

    r802 r819  
    700700            DNSResourceRecord rr=*i; 
    701701            rr.d_place=DNSResourceRecord::ANSWER; 
    702             //      if(rr.ttl < 5) 
     702            //      if(rr.ttl < 5) 
    703703            //  rr.ttl=60; 
    704             rr.ttl+=d_now.tv_sec; 
     704 
     705            rr.ttl += d_now.tv_sec; 
    705706            if(rr.qtype.getCode() == QType::NS) // people fiddle with the case 
    706707              rr.content=toLower(rr.content); // this must stay! 
     
    714715      // supplant 
    715716      for(tcache_t::const_iterator i=tcache.begin();i!=tcache.end();++i) { 
     717        if(i->second.size() > 1) { 
     718          uint32_t lowestTTL=numeric_limits<uint32_t>::max(); 
     719          for(tcache_t::value_type::second_type::iterator j=i->second.begin(); j != i->second.end(); ++j) 
     720            lowestTTL=min(lowestTTL, j->ttl); 
     721           
     722          for(tcache_t::value_type::second_type::iterator j=i->second.begin(); j != i->second.end(); ++j) 
     723            ((tcache_t::value_type::second_type::value_type*)&(*j))->ttl=lowestTTL; 
     724        } 
     725 
    716726        RC.replace(i->first.first, i->first.second, i->second); 
    717727      }