summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-03-06 02:13:10 +0000
committerSadie Powell <sadie@witchery.services>2021-03-06 02:21:32 +0000
commitc7795d6b93297ec5d1ce5d9d998a42aec575502e (patch)
tree40d56973f1e608d64d281432ebf4a5560d0555a3 /src
parent2ba32afa9a9aca7c82966b66bda16c3c3dbfbba5 (diff)
Fix not always incrementing the DNSBL stats.
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_dnsbl.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index 6712e2674..57a780ff2 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -84,7 +84,10 @@ class DNSBLResolver : public DNS::Request
/* Check the user still exists */
LocalUser* them = IS_LOCAL(ServerInstance->FindUUID(theiruid));
if (!them || them->client_sa != theirsa)
+ {
+ ConfEntry->stats_misses++;
return;
+ }
int i = countExt.get(them);
if (i)
@@ -242,6 +245,20 @@ class DNSBLResolver : public DNS::Request
void OnError(const DNS::Query *q) CXX11_OVERRIDE
{
+ bool is_miss = true;
+ switch (q->error)
+ {
+ case DNS::ERROR_NO_RECORDS:
+ case DNS::ERROR_DOMAIN_NOT_FOUND:
+ ConfEntry->stats_misses++;
+ break;
+
+ default:
+ ConfEntry->stats_errors++;
+ is_miss = false;
+ break;
+ }
+
LocalUser* them = IS_LOCAL(ServerInstance->FindUUID(theiruid));
if (!them || them->client_sa != theirsa)
return;
@@ -250,13 +267,9 @@ class DNSBLResolver : public DNS::Request
if (i)
countExt.set(them, i - 1);
- if (q->error == DNS::ERROR_NO_RECORDS || q->error == DNS::ERROR_DOMAIN_NOT_FOUND)
- {
- ConfEntry->stats_misses++;
+ if (is_miss)
return;
- }
- ConfEntry->stats_errors++;
ServerInstance->SNO->WriteGlobalSno('d', "An error occurred whilst checking whether %s (%s) is on the '%s' DNS blacklist: %s",
them->GetFullRealHost().c_str(), them->GetIPString().c_str(), ConfEntry->name.c_str(), this->manager->GetErrorStr(q->error).c_str());
}