Changeset 1774

Show
Ignore:
Timestamp:
12/30/10 22:20:06 (2 years ago)
Author:
ahu
Message:

stop bind backend from crashing on domains that are not found, plus fix up canonical ordering issues

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/backends/bind/bindbackend2.cc

    r1770 r1774  
    793793bool Bind2Backend::findBeforeAndAfterUnhashed(BB2DomainInfo& bbd, const std::string& qname, std::string& unhashed, std::string& before, std::string& after) 
    794794{ 
    795  
    796795  string domain=toLower(qname); 
    797   string lname = labelReverse(domain); 
    798  
    799   cout<<"starting lower bound for: '"<<domain<<"', search is for: '"<<lname<<"'"<<endl; 
    800  
    801   recordstorage_t::const_iterator iter = lower_bound(bbd.d_records->begin(), bbd.d_records->end(), lname); 
     796 
     797  cout<<"starting lower bound for: '"<<domain<<"'"<<endl; 
     798 
     799  recordstorage_t::const_iterator iter = lower_bound(bbd.d_records->begin(), bbd.d_records->end(), domain); 
    802800 
    803801  while(iter != bbd.d_records->begin() && !boost::prior(iter)->auth && boost::prior(iter)->qtype!=QType::NS) { 
     
    820818 
    821819  cerr<<"Now upper bound"<<endl; 
    822   iter = upper_bound(bbd.d_records->begin(), bbd.d_records->end(), lname); 
     820  iter = upper_bound(bbd.d_records->begin(), bbd.d_records->end(), domain); 
    823821 
    824822  while(iter!=bbd.d_records->end() && (!iter->auth && iter->qtype != QType::NS)) 
     
    826824 
    827825  if(iter == bbd.d_records->end()) { 
    828     cerr<<"\tFound the end!"<<endl; 
    829     after = dotConcat(labelReverse(bbd.d_records->begin()->qname), bbd.d_name); 
     826    cerr<<"\tFound the end, begin storage: '"<<bbd.d_records->begin()->qname<<"', '"<<bbd.d_name<<"'"<<endl; 
     827    after.clear(); // this does the right thing 
    830828  } else { 
    831829    cerr<<"\tFound: '"<<iter->qname<<"'"<<endl; 
     
    979977    // cerr<<"Found nothign!"<<endl; 
    980978    d_handle.d_list=false; 
     979    d_handle.d_iter = d_handle.d_end_iter  = range.first; 
    981980    return; 
    982981  }