diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-11-12 00:35:19 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-11-12 00:35:19 +0000 |
commit | c68ed91549574705fa5f3c0971e5d0878d56fac7 (patch) | |
tree | dd2379d10bdab057e7d22c617f12c5401c6afd9d /src/dns.cpp | |
parent | bedbe6480de4af64c0e752bc5ed09d0d7a9aa72c (diff) |
NOTE: our stuff for parsing multiple dns replies for dnsbl with an 'A record reply' is broken.
We will fix this at some later date. It was breaking other stuff
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8591 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dns.cpp')
-rw-r--r-- | src/dns.cpp | 76 |
1 files changed, 37 insertions, 39 deletions
diff --git a/src/dns.cpp b/src/dns.cpp index 8a274577e..2179440c0 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -868,7 +868,7 @@ DNSInfo DNSRequest::ResultIsReady(DNSHeader &header, int length, int result_we_w break; } if ((unsigned int)curanswer == header.ancount) - return std::make_pair((unsigned char*)NULL,"No more records"); + return std::make_pair((unsigned char*)NULL,"No more answers (" + ConvToStr(header.ancount) + " answers, wanted #" + ConvToStr(result_we_want) + ")"); if (i + rr.rdlength > (unsigned int)length) return std::make_pair((unsigned char*)NULL,"Resource record larger than stated"); @@ -1065,54 +1065,52 @@ void DNS::HandleEvent(EventType, int) DNSResult res(0,"",0,""); res.id = 0; ServerInstance->Log(DEBUG,"Handle DNS event"); - while ((res.id & ERROR_MASK) == 0) - { - res = this->GetResult(resultnum); - ServerInstance->Log(DEBUG,"Result %d id %d", resultnum, res.id); + res = this->GetResult(resultnum); + + ServerInstance->Log(DEBUG,"Result %d id %d", resultnum, res.id); - /* Is there a usable request id? */ - if (res.id != -1) + /* Is there a usable request id? */ + if (res.id != -1) + { + /* Its an error reply */ + if (res.id & ERROR_MASK) { - /* Its an error reply */ - if (res.id & ERROR_MASK) + /* Mask off the error bit */ + res.id -= ERROR_MASK; + /* Marshall the error to the correct class */ + if (Classes[res.id]) { - /* Mask off the error bit */ - res.id -= ERROR_MASK; - /* Marshall the error to the correct class */ - if (Classes[res.id]) - { - if (ServerInstance && ServerInstance->stats) - ServerInstance->stats->statsDnsBad++; - Classes[res.id]->OnError(RESOLVER_NXDOMAIN, res.result); - delete Classes[res.id]; - Classes[res.id] = NULL; - } - break; + if (ServerInstance && ServerInstance->stats) + ServerInstance->stats->statsDnsBad++; + Classes[res.id]->OnError(RESOLVER_NXDOMAIN, res.result); + delete Classes[res.id]; + Classes[res.id] = NULL; } - else + return; + } + else + { + /* It is a non-error result, marshall the result to the correct class */ + if (Classes[res.id]) { - /* It is a non-error result, marshall the result to the correct class */ - if (Classes[res.id]) - { - if (ServerInstance && ServerInstance->stats) - ServerInstance->stats->statsDnsGood++; - - if (!this->GetCache(res.original.c_str())) - this->cache->insert(std::make_pair(res.original.c_str(), CachedQuery(res.result, res.ttl))); + if (ServerInstance && ServerInstance->stats) + ServerInstance->stats->statsDnsGood++; - Classes[res.id]->OnLookupComplete(res.result, res.ttl, false, resultnum); - delete Classes[res.id]; - Classes[res.id] = NULL; - } + if (!this->GetCache(res.original.c_str())) + this->cache->insert(std::make_pair(res.original.c_str(), CachedQuery(res.result, res.ttl))); + + Classes[res.id]->OnLookupComplete(res.result, res.ttl, false, resultnum); + delete Classes[res.id]; + Classes[res.id] = NULL; } - - if (ServerInstance && ServerInstance->stats) - ServerInstance->stats->statsDns++; } - - resultnum++; + + if (ServerInstance && ServerInstance->stats) + ServerInstance->stats->statsDns++; } + + resultnum++; } /** Add a derived Resolver to the working set */ |