diff options
| author | 2021-01-29 18:15:32 +0000 | |
|---|---|---|
| committer | 2021-01-29 18:15:32 +0000 | |
| commit | bb35650b5721e5d951f15060e4ecf474a8343ced (patch) | |
| tree | 315cfbd8ac4cf02c1f6ce608aed8f9530f784a0d /src/modules/m_connectban.cpp | |
| parent | Allow using fixedpart/fixedquit with an empty message. (diff) | |
| parent | Remove unnecessary chdirs in the helper script. (diff) | |
| download | inspircd++-bb35650b5721e5d951f15060e4ecf474a8343ced.tar.gz inspircd++-bb35650b5721e5d951f15060e4ecf474a8343ced.tar.bz2 inspircd++-bb35650b5721e5d951f15060e4ecf474a8343ced.zip | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules/m_connectban.cpp')
| -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 70b66a786..bba54811a 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() : Module(VF_VENDOR, "Z-lines IP addresses which make excessive connections to the server.") @@ -87,7 +97,7 @@ class ModuleConnectBan void OnWebIRCAuth(LocalUser* user, const WebIRC::FlagMap* flags) override { - if (user->exempt) + if (IsExempt(user)) return; // HACK: Lower the connection attempts for the gateway IP address. The user @@ -101,7 +111,7 @@ class ModuleConnectBan void OnSetUserIP(LocalUser* u) override { - if (u->exempt || u->quitting) + if (IsExempt(u)) return; irc::sockets::cidr_mask mask(u->client_sa, GetRange(u)); |
