diff options
| author | 2022-04-17 11:02:42 +0100 | |
|---|---|---|
| committer | 2022-04-17 11:14:39 +0100 | |
| commit | 80e80132826569444e690a177f5bfc5f603fada1 (patch) | |
| tree | 497e86b783dc6beb1828a07c1ea99b8383b8ea10 /src/modules | |
| parent | Refactor CleanMask to cover more edge cases. (diff) | |
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.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/m_banexception.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_chanfilter.cpp | 3 | ||||
| -rw-r--r-- | src/modules/m_exemptchanops.cpp | 3 | ||||
| -rw-r--r-- | src/modules/m_inviteexception.cpp | 2 |
4 files changed, 6 insertions, 4 deletions
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 = "<mask>"; } - 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 = "<pattern>"; } - 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 = "<mask>"; } - 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); |
