Changeset 494
- Timestamp:
- 09/24/05 19:27:19 (8 years ago)
- Location:
- trunk/pdns/pdns/backends/bind
- Files:
-
- 3 modified
-
bindbackend2.cc (modified) (3 diffs)
-
bindbackend2.hh (modified) (1 diff)
-
zoneparser2.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pdns/pdns/backends/bind/bindbackend2.cc
r484 r494 50 50 */ 51 51 52 map<string,int>Bind2Backend::s_name_id_map;52 Bind2Backend::name_id_map_t Bind2Backend::s_name_id_map; 53 53 54 54 // this map contains BB2DomainInfo structs, each of which contains a *pointer* to domain data … … 656 656 string domain=toLower(qname); 657 657 658 if(arg().mustDo("query-logging")) 659 L<<"Lookup for '"<<qtype.getName()<<"' of '"<<domain<<"'"<<endl; 658 bool mustlog=arg().mustDo("query-logging"); 659 if(mustlog) 660 L<<Logger::Warning<<"Lookup for '"<<qtype.getName()<<"' of '"<<domain<<"'"<<endl; 660 661 661 662 while(!s_name_id_map.count(domain) && chopOff(domain)); 662 663 663 if(!s_name_id_map.count(domain)) { 664 name_id_map_t::const_iterator iditer=s_name_id_map.find(domain); 665 666 if(iditer==s_name_id_map.end()) { 667 if(mustlog) 668 L<<Logger::Warning<<"Found no authoritative zone for "<<qname<<endl; 664 669 d_handle.d_list=false; 665 670 return; 666 671 } 667 unsigned int id=s_name_id_map[domain]; 668 669 d_handle.id=id; 672 // unsigned int id=*iditer; 673 if(mustlog) 674 L<<Logger::Warning<<"Found data in zone '"<<domain<<"' with id "<<iditer->second<<endl; 675 676 d_handle.id=iditer->second; 670 677 671 678 DLOG(L<<"Bind2Backend constructing handle for search for "<<qtype.getName()<<" for "<< … … 675 682 d_handle.qname=qname.substr(0,qname.size()-domain.length()-1); // strip domain name 676 683 677 678 684 d_handle.parent=this; 679 685 d_handle.qtype=qtype; 680 686 d_handle.domain=qname.substr(qname.size()-domain.length()); 681 687 682 d_handle.d_records=s_id_zone_map[id ].d_records; // give it a copy688 d_handle.d_records=s_id_zone_map[iditer->second].d_records; // give it a copy 683 689 if(!d_handle.d_records->empty()) { 684 BB2DomainInfo& bbd=s_id_zone_map[id ];690 BB2DomainInfo& bbd=s_id_zone_map[iditer->second]; 685 691 if(!bbd.d_loaded) { 686 692 d_handle.reset(); -
trunk/pdns/pdns/backends/bind/bindbackend2.hh
r484 r494 162 162 }; 163 163 164 static map<string,int> s_name_id_map; //!< convert a name to a domain id 164 typedef map<string,int> name_id_map_t; 165 static name_id_map_t s_name_id_map; //!< convert a name to a domain id 165 166 166 167 typedef map<uint32_t, BB2DomainInfo> id_zone_map_t; -
trunk/pdns/pdns/backends/bind/zoneparser2.cc
r479 r494 182 182 rec.ttl=ttl; 183 183 rec.prio=prio; 184 185 // cerr<<"filled with type: "<<rec.qtype<<", "<<QType::chartocode(qtype.c_str())<<": "<<content<<endl; 184 186 recs.push_back(rec); 185 187 } … … 233 235 234 236 vector<string> parts; 235 stringtok(parts,tline," \t \""); // THIS IS WRONG, THE " SHOULD BE TREATED! XXX FIXME237 stringtok(parts,tline," \t"); // we used to strip " here 236 238 if(parts[0][0]!='$' && !isspace(parts[0][0])) 237 239 lastfirstword=parts[0]; … … 531 533 532 534 533 // cerr<<qname<<", "<<qclass<<", "<<qtype<<", "<<ttl<<", rest from field "<<cpos<<endl;535 // cerr<<qname<<", "<<qclass<<", "<<qtype<<", "<<ttl<<", rest from field "<<cpos<<endl; 534 536 535 537 int left=words.size()-cpos; 536 538 string content; 537 539 538 if((qtype=="MX" && left==2) || (qtype=="SRV" && left==4)){539 int prio=atoi(words[cpos++].c_str());left--;540 content=words[cpos++];left--;541 542 while(left--)543 content+=" "+words[cpos++];544 540 if((qtype=="MX" && left==2) || (qtype=="SRV" && left==4)){ 541 int prio=atoi(words[cpos++].c_str());left--; 542 content=words[cpos++];left--; 543 544 while(left--) 545 content+=" "+words[cpos++]; 546 545 547 if(content=="@") 546 548 content=d_origin; … … 567 569 if(qtype=="SOA") 568 570 soaCanonic(content); 569 571 if(qtype=="TXT" && content.size() > 2) { // strip quotes from TXT 572 if(content[0]=='"') 573 content=content.substr(1); 574 if(content[content.size()-1]=='"') 575 content.resize(content.size()-1); 576 } 577 570 578 fillRec(qname, qtype, content,ttl, 0, rec); 571 579 return true;