Nobody cared about it.
#include "dnspacket.hh"
#include "dns.hh"
-bool DNSBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId, const int best_match_len)
+bool DNSBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, const int best_match_len)
{
bool found=false;
string subdomain(target);
if( this->getSOA( subdomain, *sd, p ) ) {
sd->qname = subdomain;
- if(zoneId)
- *zoneId = sd->domain_id;
if(p->qtype.getCode() == QType::DS && pdns_iequals(subdomain, target)) {
// Found authoritative zone but look for parent zone with 'DS' record.
return false;
}
-inline int DNSReversedBackend::_getAuth(DNSPacket *p, SOAData *soa, const string &inZone, int *zoneId, const string &querykey, const int best_match_len) {
+inline int DNSReversedBackend::_getAuth(DNSPacket *p, SOAData *soa, const string &inZone, const string &querykey, const int best_match_len) {
static int negqueryttl=::arg().asNum("negquery-cache-ttl");
DLOG(L<<Logger::Error<<"SOA Query: " <<querykey<<endl);
/* all the keys are reversed. rather than reversing them again it is
* presumably quicker to just substring the zone down to size */
soa->qname = inZone.substr( inZone.length() - foundkey.length(), string::npos );
- if(zoneId)
- *zoneId = soa->domain_id;
DLOG(L<<Logger::Error<<"Successfully got record: " <<foundkey << " : " << querykey.substr( 0, foundkey.length() ) << " : " << soa->qname<<endl);
return GET_AUTH_NEG_CACHE;
}
-bool DNSReversedBackend::getAuth(DNSPacket *p, SOAData *soa, const string &inZone, int *zoneId, const int best_match_len) {
+bool DNSReversedBackend::getAuth(DNSPacket *p, SOAData *soa, const string &inZone, const int best_match_len) {
// Reverse the lowercased query string
string zone = toLower(inZone);
string querykey = labelReverse(zone);
- int ret = _getAuth( p, soa, inZone, zoneId, querykey, best_match_len );
+ int ret = _getAuth( p, soa, inZone, querykey, best_match_len );
/* If this is disabled then we would just cache the tree structure not the
* leaves which should give the best performance and a nice small negcache
virtual void getAllDomains(vector<DomainInfo> *domains, bool include_disabled=false) { }
/** Determines if we are authoritative for a zone, and at what level */
- virtual bool getAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId, const int best_match_len);
+ virtual bool getAuth(DNSPacket *p, SOAData *sd, const string &target, const int best_match_len);
struct KeyData {
unsigned int id;
virtual bool getAuthZone( string &rev_zone ) { return false; }; // Must be overridden
/* Once the record has been found, this will be called to get the data
- * associated with the record so the backend can set up soa and zoneId
- * respectively. soa->qname does not need to be set. Return false if
+ * associated with the record so the backend can set up soa.
+ * soa->qname does not need to be set. Return false if
* there is a problem getting the data.
* */
virtual bool getAuthData( SOAData &soa, DNSPacket *p=0) { return false; }; // Must be overridden
- bool getAuth(DNSPacket *p, SOAData *soa, const string &inZone, int *zoneId, const int best_match_len);
- inline int _getAuth(DNSPacket *p, SOAData *soa, const string &inZone, int *zoneId, const string &querykey, const int best_match_len);
+ bool getAuth(DNSPacket *p, SOAData *soa, const string &inZone, const int best_match_len);
+ inline int _getAuth(DNSPacket *p, SOAData *soa, const string &inZone, const string &querykey, const int best_match_len);
/* Only called for stuff like signing or AXFR transfers */
bool _getSOA(const string &rev_zone, SOAData &soa, DNSPacket *p);
*shouldRecurse=false;
DNSResourceRecord rr;
SOAData sd;
- sd.db=0;
-
+
string subdomain="";
string soa;
int retargetcount=0;
return r;
}
- if(!B.getAuth(p, &sd, target, 0)) {
+ if(!B.getAuth(p, &sd, target)) {
DLOG(L<<Logger::Error<<"We have no authority over zone '"<<target<<"'"<<endl);
if(r->d.ra) {
DLOG(L<<Logger::Error<<"Recursion is available for this remote, doing that"<<endl);
}
}
-bool UeberBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId)
+bool UeberBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target)
{
int best_match_len = -1;
bool from_cache = false; // Was this result fetched from the cache?
}
for(vector<DNSBackend *>::const_iterator i=backends.begin(); i!=backends.end();++i)
- if((*i)->getAuth(p, sd, target, zoneId, best_match_len)) {
+ if((*i)->getAuth(p, sd, target, best_match_len)) {
best_match_len = sd->qname.length();
from_cache = false;
void lookup(const QType &, const string &qdomain, DNSPacket *pkt_p=0, int zoneId=-1);
- bool getAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId);
+ bool getAuth(DNSPacket *p, SOAData *sd, const string &target);
bool getSOA(const string &domain, SOAData &sd, DNSPacket *p=0);
bool getSOAUncached(const string &domain, SOAData &sd, DNSPacket *p=0); // same, but ignores cache
bool list(const string &target, int domain_id, bool include_disabled=false);
DNSPacket fakePacket;
SOAData sd;
fakePacket.qtype = QType::PTR;
- if (!B.getAuth(&fakePacket, &sd, ptr.qname, 0))
+ if (!B.getAuth(&fakePacket, &sd, ptr.qname))
throw ApiException("Could not find domain for PTR '"+ptr.qname+"' requested for '"+ptr.content+"'");
ptr.domain_id = sd.domain_id;
sd.db = (DNSBackend *)-1; // getAuth() cache bypass
fakePacket.qtype = QType::PTR;
- if (!B.getAuth(&fakePacket, &sd, rr.qname, 0))
+ if (!B.getAuth(&fakePacket, &sd, rr.qname))
throw ApiException("Could not find domain for PTR '"+rr.qname+"' requested for '"+rr.content+"' (while saving)");
sd.db->startTransaction(rr.qname);