Changeset 1926

Show
Ignore:
Timestamp:
01/28/11 12:09:22 (2 years ago)
Author:
ahu
Message:

Jan-Piet Mens discovered that we did not correctly fill out the 'auth' field on incoming zonetransfers for non-secured zones, even though
this is necessary for *all* zones.

Files:
1 modified

Legend:

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

    r1893 r1926  
    8282      dnssecZone=true; 
    8383      haveNSEC3=dk.getNSEC3PARAM(domain, &ns3pr, &narrow); 
    84       string hashed; 
     84    }  
     85    
     86    if(dnssecZone) { 
    8587      if(!haveNSEC3)  
    86         cerr<<"Adding NSEC ordering information"<<endl; 
    87       else if(!narrow) 
    88         cerr<<"Adding NSEC3 hashed ordering information for '"<<domain<<"'"<<endl; 
    89       else  
    90         cerr<<"Erasing NSEC3 ordering since we are narrow, only setting 'auth' fields"<<endl; 
    91     } 
     88                                L<<Logger::Info<<"Adding NSEC ordering information"<<endl; 
     89                        else if(!narrow) 
     90        L<<Logger::Info<<"Adding NSEC3 hashed ordering information for '"<<domain<<"'"<<endl; 
     91                        else  
     92        L<<Logger::Info<<"Erasing NSEC3 ordering since we are narrow, only setting 'auth' fields"<<endl; 
     93                }     
    9294 
    9395    if(!B->getDomainInfo(domain, di) || !di.backend) { 
     
    111113          continue; 
    112114        } 
    113         if(dnssecZone) { 
    114           if(i->qtype.getCode() == QType::NS && !pdns_iequals(i->qname, domain))  
    115             nsset.insert(i->qname); 
    116           qnames.insert(i->qname); 
    117         }   
     115         
     116        if(i->qtype.getCode() == QType::NS && !pdns_iequals(i->qname, domain))  
     117          nsset.insert(i->qname); 
     118        qnames.insert(i->qname); 
     119           
    118120        i->domain_id=domain_id; 
    119121        if(i->qtype.getCode()>=1024) 
     
    123125      } 
    124126    } 
    125     if(dnssecZone) { 
    126       string hashed; 
    127       BOOST_FOREACH(const string& qname, qnames) 
    128       { 
    129         string shorter(qname); 
    130         bool auth=true; 
    131         do { 
    132           if(nsset.count(shorter)) {   
    133             auth=false; 
    134             break; 
    135           } 
    136         }while(chopOff(shorter)); 
     127     
     128    string hashed; 
     129    BOOST_FOREACH(const string& qname, qnames) 
     130    { 
     131      string shorter(qname); 
     132      bool auth=true; 
     133      do { 
     134        if(nsset.count(shorter)) {   
     135          auth=false; 
     136          break; 
     137        } 
     138      }while(chopOff(shorter)); 
    137139       
    138         if(!haveNSEC3) // NSEC 
    139           di.backend->updateDNSSECOrderAndAuth(domain_id, domain, qname, auth); 
    140         else { 
    141           if(!narrow) { 
    142             hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, qname))); 
    143             cerr<<"'"<<qname<<"' -> '"<< hashed <<"'"<<endl; 
    144           } 
    145           di.backend->updateDNSSECOrderAndAuthAbsolute(domain_id, qname, hashed, auth); 
     140      if(dnssecZone && !haveNSEC3) // NSEC 
     141        di.backend->updateDNSSECOrderAndAuth(domain_id, domain, qname, auth); 
     142      else { 
     143        if(dnssecZone && !narrow) {  
     144          hashed=toLower(toBase32Hex(hashQNameWithSalt(ns3pr.d_iterations, ns3pr.d_salt, qname))); 
    146145        } 
     146        di.backend->updateDNSSECOrderAndAuthAbsolute(domain_id, qname, hashed, auth); // this should always be done 
    147147      } 
    148148    } 
    149      
     149         
    150150    di.backend->commitTransaction(); 
    151151    di.backend->setFresh(domain_id);