From 83a2eddaaa8cc398c1ba87bed723e483ea369b9c Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Tue, 7 Aug 2018 16:50:01 +0100 Subject: [PATCH] Switch m_dnsbl to use its own snomask character. --- docs/conf/helpop-full.conf.example | 2 ++ src/modules/m_dnsbl.cpp | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/conf/helpop-full.conf.example b/docs/conf/helpop-full.conf.example index 6d0ea10e9..840db56d5 100644 --- a/docs/conf/helpop-full.conf.example +++ b/docs/conf/helpop-full.conf.example @@ -1047,6 +1047,8 @@ Note that all /STATS use is broadcast to online IRC operators."> A Allows receipt of remote announcement messages. c Allows receipt of local connect messages. C Allows receipt of remote connect messages. + d Allows recript of local DNSBL messages. + D Allows recript of remote DNSBL messages. f Allows receipt of flooding notices. g Allows receipt of globops (requires the globops module). j Allows receipt of channel creation notices (requires the chancreate module). diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index e0a827f04..606feed10 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -74,7 +74,7 @@ class DNSBLResolver : public DNS::Request // All replies should be in 127.0.0.0/8 if (ans_record->rdata.compare(0, 4, "127.") != 0) { - ServerInstance->SNO->WriteGlobalSno('a', "DNSBL: %s returned address outside of acceptable subnet 127.0.0.0/8: %s", ConfEntry->domain.c_str(), ans_record->rdata.c_str()); + ServerInstance->SNO->WriteGlobalSno('d', "DNSBL: %s returned address outside of acceptable subnet 127.0.0.0/8: %s", ConfEntry->domain.c_str(), ans_record->rdata.c_str()); ConfEntry->stats_misses++; return; } @@ -200,7 +200,7 @@ class DNSBLResolver : public DNS::Request break; } - ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s%s detected as being on a DNS blacklist (%s) with result %d", them->nick.empty() ? "" : "", them->GetFullRealHost().c_str(), ConfEntry->domain.c_str(), (ConfEntry->type==DNSBLConfEntry::A_BITMASK) ? bitmask : record); + ServerInstance->SNO->WriteGlobalSno('d', "Connecting user %s%s detected as being on a DNS blacklist (%s) with result %d", them->nick.empty() ? "" : "", them->GetFullRealHost().c_str(), ConfEntry->domain.c_str(), (ConfEntry->type==DNSBLConfEntry::A_BITMASK) ? bitmask : record); } else ConfEntry->stats_misses++; @@ -255,6 +255,11 @@ class ModuleDNSBL : public Module, public Stats::EventListener { } + void init() CXX11_OVERRIDE + { + ServerInstance->SNO->EnableSnomask('d', "DNSBL"); + } + Version GetVersion() CXX11_OVERRIDE { return Version("Provides handling of DNS blacklists", VF_VENDOR); @@ -302,29 +307,29 @@ class ModuleDNSBL : public Module, public Stats::EventListener if ((e->bitmask <= 0) && (DNSBLConfEntry::A_BITMASK == e->type)) { std::string location = tag->getTagLocation(); - ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): invalid bitmask", location.c_str()); + ServerInstance->SNO->WriteGlobalSno('d', "DNSBL(%s): invalid bitmask", location.c_str()); } else if (e->name.empty()) { std::string location = tag->getTagLocation(); - ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): Invalid name", location.c_str()); + ServerInstance->SNO->WriteGlobalSno('d', "DNSBL(%s): Invalid name", location.c_str()); } else if (e->domain.empty()) { std::string location = tag->getTagLocation(); - ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): Invalid domain", location.c_str()); + ServerInstance->SNO->WriteGlobalSno('d', "DNSBL(%s): Invalid domain", location.c_str()); } else if (e->banaction == DNSBLConfEntry::I_UNKNOWN) { std::string location = tag->getTagLocation(); - ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): Invalid banaction", location.c_str()); + ServerInstance->SNO->WriteGlobalSno('d', "DNSBL(%s): Invalid banaction", location.c_str()); } else { if (e->reason.empty()) { std::string location = tag->getTagLocation(); - ServerInstance->SNO->WriteGlobalSno('a', "DNSBL(%s): empty reason, using defaults", location.c_str()); + ServerInstance->SNO->WriteGlobalSno('d', "DNSBL(%s): empty reason, using defaults", location.c_str()); e->reason = "Your IP has been blacklisted."; } -- 2.39.5