X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_connectban.cpp;h=b4b16f5394420a442fd5c6f957253065253c1cc2;hb=05fe4bdd1dbe3162abb6efe830bc21bb94c73fa8;hp=09390bb07bc8d4bb6b4776b45b53580533b23481;hpb=116244f190e8146395d40fb5a43af6b9bb1f6d1f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index 09390bb07..b4b16f539 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2019 Matt Schatz * Copyright (C) 2014 Googolplexed - * Copyright (C) 2013, 2017-2019 Sadie Powell + * Copyright (C) 2013, 2017-2020 Sadie Powell * Copyright (C) 2012-2014 Attila Molnar * Copyright (C) 2012, 2019 Robby * Copyright (C) 2009-2010 Daniel De Graaf @@ -61,6 +61,16 @@ class ModuleConnectBan return 0; } + static bool IsExempt(LocalUser* user) + { + // E-lined and already banned users shouldn't be hit. + if (user->exempt || user->quitting) + return true; + + // Users in an exempt class shouldn't be hit. + return user->GetClass() && !user->GetClass()->config->getBool("useconnectban", true); + } + public: ModuleConnectBan() : WebIRC::EventListener(this) @@ -91,7 +101,7 @@ class ModuleConnectBan void OnWebIRCAuth(LocalUser* user, const WebIRC::FlagMap* flags) CXX11_OVERRIDE { - if (user->exempt) + if (IsExempt(user)) return; // HACK: Lower the connection attempts for the gateway IP address. The user @@ -105,7 +115,7 @@ class ModuleConnectBan void OnSetUserIP(LocalUser* u) CXX11_OVERRIDE { - if (u->exempt) + if (IsExempt(u)) return; irc::sockets::cidr_mask mask(u->client_sa, GetRange(u));