aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2024-09-19 01:19:30 +0100
committerGravatar Sadie Powell2024-09-19 01:19:30 +0100
commitaa7394ca95906d891703ac0c1c5485ceeb31a155 (patch)
treee6d729b247d39fae3a3816889c3c4c2152456374 /src/modules
parentUpdate the readme for the CentOS packages being dropped. (diff)
Expand IPv6 addresses in connectban to avoid breaking S2S.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_connectban.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp
index bcacfcc3a..9e33dc6b8 100644
--- a/src/modules/m_connectban.cpp
+++ b/src/modules/m_connectban.cpp
@@ -150,14 +150,20 @@ class ModuleConnectBan CXX11_FINAL
if (i->second >= threshold)
{
+ // If an IPv6 address begins with a colon then expand it
+ // slightly to avoid breaking the server protocol.
+ std::string maskstr = mask.str();
+ if (maskstr[0] == ':')
+ maskstr.insert(maskstr.begin(), 1, '0');
+
// Create Z-line for set duration.
- ZLine* zl = new ZLine(ServerInstance->Time(), banduration, MODNAME "@" + ServerInstance->Config->ServerName, banmessage, mask.str());
+ ZLine* zl = new ZLine(ServerInstance->Time(), banduration, MODNAME "@" + ServerInstance->Config->ServerName, banmessage, maskstr);
if (!ServerInstance->XLines->AddLine(zl, NULL))
{
delete zl;
return;
}
- std::string maskstr = mask.str();
+
ServerInstance->SNO->WriteToSnoMask('x', "%s added a timed Z-line on %s, expires in %s (on %s): %s",
zl->source.c_str(), maskstr.c_str(), InspIRCd::DurationString(zl->duration).c_str(),
InspIRCd::TimeString(zl->expiry).c_str(), zl->reason.c_str());