diff options
-rw-r--r-- | docs/conf/inspircd.conf.example | 4 | ||||
-rw-r--r-- | src/modules/m_connectban.cpp | 14 |
2 files changed, 16 insertions, 2 deletions
diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index 06ad9669d..fecaafdc2 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -304,6 +304,10 @@ # in this class. This can save a lot of resources on very busy servers. resolvehostnames="yes" + # useconnectban: Defines if users in this class should be exempt from connectban limits. + # This setting only has effect when the connectban module is loaded. + #useconnectban="yes" + # usednsbl: Defines whether or not users in this class are subject to DNSBL. Default is yes. # This setting only has effect when the dnsbl module is loaded. #usednsbl="yes" diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index 81b0fcfa7..b4b16f539 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -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 || u->quitting) + if (IsExempt(u)) return; irc::sockets::cidr_mask mask(u->client_sa, GetRange(u)); |