}
}
-bool operator<(const Bind2DNSRecord &a, const string &b)
-{
- return a.qname < b;
-}
-
-bool operator<(const string &a, const Bind2DNSRecord &b)
-{
- return a < b.qname;
-}
void Bind2Backend::lookup(const QType &qtype, const string &qname, DNSPacket *pkt_p, int zoneId )
string domain=toLower(qname);
- bool mustlog=::arg().mustDo("query-logging");
+ static bool mustlog=::arg().mustDo("query-logging");
if(mustlog)
L<<Logger::Warning<<"Lookup for '"<<qtype.getName()<<"' of '"<<domain<<"'"<<endl;
shared_ptr<State> state = s_state;
- while(!state->name_id_map.count(domain) && chopOff(domain));
+ name_id_map_t::const_iterator iditer;
+ while((iditer=state->name_id_map.find(domain)) == state->name_id_map.end() && chopOff(domain))
+ ;
- name_id_map_t::const_iterator iditer=state->name_id_map.find(domain);
if(iditer==state->name_id_map.end()) {
if(mustlog)
}
// unsigned int id=*iditer;
if(mustlog)
- L<<Logger::Warning<<"Found data in zone '"<<domain<<"' with id "<<iditer->second<<endl;
+ L<<Logger::Warning<<"Found a zone '"<<domain<<"' (with id " << iditer->second<<") that might contain data "<<endl;
d_handle.id=iditer->second;
state = s_state;
}
- d_handle.d_records = state->id_zone_map[iditer->second].d_records; // give it a reference counted copy
+ d_handle.d_records = bbd.d_records; // give it a reference counted copy
if(d_handle.d_records->empty())
DLOG(L<<"Query with no results"<<endl);
string lname=toLower(d_handle.qname);
range=equal_range(d_handle.d_records->begin(), d_handle.d_records->end(), lname);
+ d_handle.mustlog = mustlog;
if(range.first==range.second) {
d_handle.d_list=false;
else {
d_handle.d_iter=range.first;
d_handle.d_end_iter=range.second;
- d_handle.mustlog = mustlog;
}
d_handle.d_list=false;
bool Bind2Backend::get(DNSResourceRecord &r)
{
- if(!d_handle.d_records)
+ if(!d_handle.d_records) {
+ if(d_handle.mustlog)
+ L<<Logger::Warning<<"There were no answers"<<endl;
return false;
+ }
if(!d_handle.get(r)) {
- d_handle.reset();
+ if(d_handle.mustlog)
+ L<<Logger::Warning<<"End of answers"<<endl;
- if(::arg().mustDo("query-logging"))
- L<<"End of answers"<<endl;
+ d_handle.reset();
return false;
}