return true;
}
-bool DNSBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId, const size_t best_match_len)
+bool DNSBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId, const int best_match_len)
{
bool found=false;
string subdomain(target);
do {
- if( best_match_len >= subdomain.length() )
+ if( best_match_len >= (int)subdomain.length() )
break;
if( this->getSOA( subdomain, *sd, p ) ) {
return false;
}
-inline int DNSReversedBackend::_getAuth(DNSPacket *p, SOAData *soa, const string &inZone, int *zoneId, const string &querykey, const size_t best_match_len) {
+inline int DNSReversedBackend::_getAuth(DNSPacket *p, SOAData *soa, const string &inZone, int *zoneId, const string &querykey, const int best_match_len) {
static int negqueryttl=::arg().asNum("negquery-cache-ttl");
DLOG(L<<Logger::Error<<"SOA Query: " <<querykey<<endl);
* the risk of something being added to the neg-querycache that may
* interfear with future queries
*/
- if( best_match_len >= querykey.length() ) {
+ if( best_match_len >= (int)querykey.length() ) {
DLOG(L<<Logger::Error<<"Best match was better from a different client"<<endl);
return GET_AUTH_NEG_DONTCACHE;
}
// Got a match from a previous backend that was longer than this - no need
// to continue.
- if( best_match_len && best_match_len >= diff_point ) {
+ if( best_match_len && best_match_len >= (int)diff_point ) {
DLOG(L<<Logger::Error<<"Best match was better from a different client"<<endl);
return GET_AUTH_NEG_DONTCACHE;
}
- // Strings totally different. If we want to store root records in the
- // database (and the database supports zero-length keys) we could probably
- // just remove this test but would need testing to ensure the rest of the
- // functions worked correctly
- if( diff_point == 0 )
+ // If diff_point is 0 then either strings are totally different OR root
+ // zone was returned.
+ if( diff_point == 0 && foundkey.length() != 0 )
return GET_AUTH_NEG_CACHE;
/* If the strings are the same (ie diff_point == querykey.length()) then we
return GET_AUTH_NEG_CACHE;
}
-bool DNSReversedBackend::getAuth(DNSPacket *p, SOAData *soa, const string &inZone, int *zoneId, const size_t best_match_len) {
+bool DNSReversedBackend::getAuth(DNSPacket *p, SOAData *soa, const string &inZone, int *zoneId, const int best_match_len) {
// Reverse the lowercased query string
string zone = toLower(inZone);
string querykey( zone.rbegin(), zone.rend() );
virtual void getAllDomains(vector<DomainInfo> *domains) { }
/** 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 size_t best_match_len);
+ virtual bool getAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId, const int best_match_len);
struct KeyData {
unsigned int id;
* */
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 size_t best_match_len);
- inline int _getAuth(DNSPacket *p, SOAData *soa, const string &inZone, int *zoneId, const string &querykey, const size_t best_match_len);
+ 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);
/* Only called for stuff like signing or AXFR transfers */
bool _getSOA(const string &rev_zone, SOAData &soa, DNSPacket *p);
bool UeberBackend::getAuth(DNSPacket *p, SOAData *sd, const string &target, int *zoneId)
{
- size_t best_match_len = 0;
+ int best_match_len = -1;
bool from_cache = false; // Was this result fetched from the cache?
check_op_requests();
// Shortcut for the case that we got a direct hit - no need to go
// through the other backends then.
- if( best_match_len == target.length() )
+ if( best_match_len == (int)target.length() )
goto auth_found;
}
- if( best_match_len == 0 )
+ if( best_match_len == -1 )
return false;
auth_found: