From 80e80132826569444e690a177f5bfc5f603fada1 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 17 Apr 2022 11:02:42 +0100 Subject: Remove ValidateParam and rename CanonicalizeParam. There's basically no safe way to handle a malformed list mode sent by a remote server without causing a desync. Its probably for the best if we just only apply validation to locally added list modes entries. --- src/modules/m_banexception.cpp | 2 +- src/modules/m_chanfilter.cpp | 3 ++- src/modules/m_exemptchanops.cpp | 3 ++- src/modules/m_inviteexception.cpp | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index b975ab7c9..9234c1b6f 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -50,7 +50,7 @@ public: syntax = ""; } - bool CanonicalizeParam(LocalUser* user, Channel* channel, std::string& parameter) override + bool ValidateParam(LocalUser* user, Channel* channel, std::string& parameter) override { if (!extbanmgr || !extbanmgr->Canonicalize(parameter)) ModeParser::CleanMask(parameter); diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index c399be68a..a45440a0c 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -47,8 +47,9 @@ public: syntax = ""; } - bool ValidateParam(User* user, Channel* chan, const std::string& parameter) override + bool ValidateParam(LocalUser* user, Channel* chan, std::string& parameter) override { + // We only enforce the length restriction against local users to avoid causing a desync. if (parameter.length() > maxlen) { user->WriteNumeric(Numerics::InvalidModeParameter(chan, this, parameter, "Entry is too long for the spamfilter list.")); diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index 89c1688fc..c384e723f 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -81,8 +81,9 @@ public: return MOD_RES_DENY; } - bool ValidateParam(User* user, Channel* chan, const std::string& parameter) override + bool ValidateParam(LocalUser* user, Channel* chan, std::string& parameter) override { + // We only enforce the format restriction against local users to avoid causing a desync. std::string restriction; std::string prefix; if (!ParseEntry(parameter, restriction, prefix)) diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index 8db100230..b2f5c8afa 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -48,7 +48,7 @@ public: syntax = ""; } - bool CanonicalizeParam(LocalUser* user, Channel* channel, std::string& parameter) override + bool ValidateParam(LocalUser* user, Channel* channel, std::string& parameter) override { if (!extbanmgr || !extbanmgr->Canonicalize(parameter)) ModeParser::CleanMask(parameter); -- cgit v1.3.1-10-gc9f91