diff options
author | Sadie Powell <sadie@witchery.services> | 2021-01-27 19:31:48 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2021-01-27 19:39:32 +0000 |
commit | 05fe4bdd1dbe3162abb6efe830bc21bb94c73fa8 (patch) | |
tree | 89f3ffc6966602c55384544f176498a7fb9ad986 /src/modules | |
parent | 859a79923a1e9df7195e1320d66b61ee162f52cc (diff) |
Allow disabling connectban for specific connect classes.
Ref: #1841.
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_connectban.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
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)); |