From 5da7043eb65aed52508322b6dbd1641c984e3637 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 4 May 2007 19:50:33 +0000 Subject: Fix for bug #268, repeated messages on users who are already glined git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6880 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_dnsbl.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index c7631ae78..ccb2dcd9c 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -17,6 +17,7 @@ #include #include #include "inspircd.h" +#include "xline.h" #include "dns.h" #include "users.h" #include "channels.h" @@ -64,7 +65,8 @@ class DNSBLResolver : public Resolver // Now we calculate the bitmask: 256*(256*(256*a+b)+c)+d if(result.length()) { - unsigned int bitmask=0; + unsigned int bitmask = 0; + bool show = false; in_addr resultip; /* Convert the result to an in_addr (we can gaurantee we got ipv4) @@ -87,7 +89,6 @@ class DNSBLResolver : public Resolver x = reason.find("%ip%"); } - ServerInstance->WriteOpers("*** Connecting user %s detected as being on a DNS blacklist (%s) with result %d", them->GetFullRealHost(), ConfEntry->name.c_str(), bitmask); ConfEntry->stats_hits++; switch (ConfEntry->banaction) @@ -99,19 +100,21 @@ class DNSBLResolver : public Resolver } case DNSBLConfEntry::I_KLINE: { - ServerInstance->AddKLine(ConfEntry->duration, ServerInstance->Config->ServerName, reason, std::string("*@") + them->GetIPString()); - FOREACH_MOD(I_OnAddKLine,OnAddKLine(ConfEntry->duration, NULL, reason, std::string("*@") + them->GetIPString())); + std::string ban = std::string("*@") + them->GetIPString(); + show = ServerInstance->XLines->add_kline(ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), ban.c_str()); + FOREACH_MOD(I_OnAddKLine,OnAddKLine(ConfEntry->duration, NULL, reason, ban)); break; } case DNSBLConfEntry::I_GLINE: { - ServerInstance->AddGLine(ConfEntry->duration, ServerInstance->Config->ServerName, reason, std::string("*@") + them->GetIPString()); - FOREACH_MOD(I_OnAddGLine,OnAddGLine(ConfEntry->duration, NULL, reason, std::string("*@") + them->GetIPString())); + std::string ban = std::string("*@") + them->GetIPString(); + show = ServerInstance->XLines->add_gline(ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), ban.c_str()); + FOREACH_MOD(I_OnAddGLine,OnAddGLine(ConfEntry->duration, NULL, reason, ban)); break; } case DNSBLConfEntry::I_ZLINE: { - ServerInstance->AddZLine(ConfEntry->duration, ServerInstance->Config->ServerName, reason, them->GetIPString()); + show = ServerInstance->XLines->add_zline(ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), them->GetIPString()); FOREACH_MOD(I_OnAddZLine,OnAddZLine(ConfEntry->duration, NULL, reason, them->GetIPString())); break; } @@ -121,6 +124,9 @@ class DNSBLResolver : public Resolver } break; } + + if (show) + ServerInstance->WriteOpers("*** Connecting user %s detected as being on a DNS blacklist (%s) with result %d", them->GetFullRealHost(), ConfEntry->name.c_str(), bitmask); } else ConfEntry->stats_misses++; -- cgit v1.2.3