Changeset 2062

Show
Ignore:
Timestamp:
03/14/11 13:57:00 (2 years ago)
Author:
ahu
Message:

teach built-in authoritative server in the powerdns recursor to understand wildcards

Files:
1 modified

Legend:

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

    r1996 r2062  
    175175  } 
    176176 
     177  LOG<<prefix<<qname<<": nothing found so far in '"<<authdomain<<"', trying wildcards"<<endl; 
     178  string wcarddomain(qname); 
     179  while(!pdns_iequals(wcarddomain, iter->first) && chopOffDotted(wcarddomain)) { 
     180    LOG<<prefix<<qname<<": trying '*."+wcarddomain+"' in "<<authdomain<<endl; 
     181    range=iter->second.d_records.equal_range(make_tuple("*."+wcarddomain));  
     182    if(range.first==range.second) 
     183      continue; 
     184 
     185    for(ziter=range.first; ziter!=range.second; ++ziter) { 
     186      DNSResourceRecord rr=*ziter; 
     187      if(rr.qtype == qtype || qtype.getCode() == QType::ANY) { 
     188        rr.qname = qname; 
     189        rr.d_place=DNSResourceRecord::ANSWER; 
     190        ret.push_back(rr); 
     191      } 
     192    } 
     193    LOG<<prefix<<qname<<": in '"<<authdomain<<"', had wildcard match on '*."+wcarddomain+"'"<<endl; 
     194    res=RCode::NoError; 
     195    return true; 
     196  } 
     197 
    177198  string nsdomain(qname); 
    178199 
     
    205226  return true; 
    206227} 
    207  
    208  
    209228 
    210229void SyncRes::doEDNSDumpAndClose(int fd)