diff options
| author | 2022-12-19 11:29:55 +0000 | |
|---|---|---|
| committer | 2022-12-19 11:29:55 +0000 | |
| commit | dcd6fa89bc75da4c05031b5af4e44304e3ad6980 (patch) | |
| tree | ef469c114c23d99b71cccdba1ee5acdfb364d6ce /src | |
| parent | Use in_port_t instead of int/unsigned int/long. (diff) | |
Fix parsing extbans in banredirect and timedbans.
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules/m_banredirect.cpp | 8 | ||||
| -rw-r--r-- | src/modules/m_timedbans.cpp | 9 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 83ad230e8..f47aacbc8 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -31,6 +31,7 @@ #include "inspircd.h" #include "listmode.h" +#include "modules/extban.h" /* Originally written by Om, January 2009 */ @@ -55,11 +56,13 @@ class BanRedirect final { public: ChanModeReference banmode; + ExtBan::ManagerRef extbanmgr; SimpleExtItem<BanRedirectList> redirectlist; BanRedirect(Module* parent) : ModeWatcher(parent, "ban", MODETYPE_CHANNEL) , banmode(parent, "ban") + , extbanmgr(parent) , redirectlist(parent, "banredirect", ExtensionType::CHANNEL) { } @@ -81,8 +84,9 @@ public: enum { NICK, IDENT, HOST, CHAN } current = NICK; std::string::iterator start_pos = change.param.begin(); - if (change.param.length() >= 2 && change.param[1] == ':') - return true; + std::string unused = change.param; + if (extbanmgr && extbanmgr->Canonicalize(unused)) + return true; // Skip extbans. if (change.param.find('#') == std::string::npos) return true; diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index b5348c84b..6dd1d9f79 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -32,6 +32,7 @@ #include "inspircd.h" #include "listmode.h" +#include "modules/extban.h" #include "numerichelper.h" // Holds a timed ban @@ -50,7 +51,9 @@ timedbans TimedBanList; class CommandTban final : public Command { +private: ChanModeReference banmode; + ExtBan::ManagerRef extbanmgr; bool IsBanSet(Channel* chan, const std::string& mask) { @@ -77,6 +80,7 @@ public: CommandTban(Module* Creator) : Command(Creator, "TBAN", 3) , banmode(Creator, "ban") + , extbanmgr(Creator) { syntax = { "<channel> <duration> <banmask>" }; } @@ -107,9 +111,8 @@ public: unsigned long expire = duration + ServerInstance->Time(); std::string mask = parameters[2]; - bool isextban = ((mask.size() > 2) && (mask[1] == ':')); - if (!isextban && !InspIRCd::IsValidMask(mask)) - mask.append("!*@*"); + if (!extbanmgr || !extbanmgr->Canonicalize(mask)) + ModeParser::CleanMask(mask); if (IsBanSet(channel, mask)) { |
