return false;
}
-#if 0
-/* returns 1 if everything is done & ready, 0 if the search should continue, 2 if a 'NO-ERROR' response should be generated */
-int PacketHandler::makeCanonic(DNSPacket *p, DNSPacket *r, string &target)
-{
- DNSResourceRecord rr;
-
- bool found=false, rfound=false;
-
- if(p->qtype.getCode()!=QType::CNAME && !d_doCNAME)
- return 0;
-
- // Traverse a CNAME chain if needed
- for(int numloops=0;;numloops++) {
- if(numloops==10) {
- L<<Logger::Error<<"Detected a CNAME loop involving "<<target<<", sending SERVFAIL"<<endl;
- r->setRcode(2);
- return 1;
- }
-
- B.lookup(QType(QType::ANY),target,p);
-
- bool shortcut=p->qtype.getCode()!=QType::SOA && p->qtype.getCode()!=QType::ANY;
- int hits=0;
- bool relevantNS=false;
- bool sawDS=false;
- bool crossedZoneCut = false;
- while(B.get(rr)) {
- if(rr.qtype.getCode() == QType::NS && p->qtype.getCode() != QType::NS) { // possible retargeting
- relevantNS=true;
- }
-
- if(rr.qtype.getCode()==QType::DS && p->qtype.getCode() == QType::NS && p->d_dnssecOk) {
- sawDS = true;
- r->addRecord(rr);
- }
-
- if(rr.qtype.getCode()!=QType::NS || p->qtype.getCode()==QType::NS)
- hits++;
- if(!rfound && rr.qtype.getCode()==QType::CNAME) {
- found=true;
- r->addRecord(rr);
- target=rr.content; // for retargeting
- }
- if(shortcut && !found && rr.qtype==p->qtype) {
- if(!rr.auth) {
- // no idea why this if is here
- }
-
- rfound=true;
- r->addRecord(rr);
- }
- }
-
- if(crossedZoneCut) {
- DLOG(L<<"Should return NS records, and this A/AAAA record in the additional section.."<<endl);
- }
-
- if(!sawDS && p->qtype.getCode() == QType::NS && p->d_dnssecOk && rfound) {
- addNSECX(p, r, p->qdomain, "", 2); // make it 'official' that we have no DS
- }
-
- if(hits && !relevantNS && !found && !rfound && shortcut ) { // XXX FIXME !numloops. we found matching qnames but not a qtype
- DLOG(L<<"Found matching qname, but not the qtype"<<endl);
- return 2;
- }
-
- if(rfound)
- return 1; // ANY lookup found the right answer immediately
-
- if(found) {
- if(p->qtype.getCode()==QType::CNAME) // they really wanted a CNAME!
- return 1;
- DLOG(L<<"Looping because of a CNAME to "<<target<<endl);
- found=false;
- }
- else
- break;
- }
-
- // we now have what we really search for ready in 'target'
- return 0;
-}
-
-#endif
/* Semantics: