diff options
author | Adam <Adam@anope.org> | 2014-05-13 22:57:53 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-05-13 22:57:53 -0400 |
commit | 63b02b8c97e73d5a1fc7005e9693a954179ded0d (patch) | |
tree | 84d67d16b8f984eef67653c7a50f7154aa33bb23 /src/modes.cpp | |
parent | 1c8a77ab9f4adfd0afd8217bc462bb338925dcea (diff) |
Sanitize nuh masks more to prevent the other side from rewriting them, which screws with our internal tracking of them
Diffstat (limited to 'src/modes.cpp')
-rw-r--r-- | src/modes.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/modes.cpp b/src/modes.cpp index 668f7c150..4138cfebe 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -175,6 +175,13 @@ ChannelModeList::ChannelModeList(const Anope::string &cm, char mch) : ChannelMod this->type = MODE_LIST; } +bool ChannelModeList::IsValid(Anope::string &mask) const +{ + if (name == "BAN" || name == "EXCEPT" || name == "INVITEOVERRIDE") + mask = IRCD->NormalizeMask(mask); + return true; +} + ChannelModeParam::ChannelModeParam(const Anope::string &cm, char mch, bool ma) : ChannelMode(cm, mch), minus_no_arg(ma) { this->type = MODE_PARAM; @@ -231,7 +238,7 @@ bool UserModeNoone::CanSet(User *u) const return false; } -bool ChannelModeKey::IsValid(const Anope::string &value) const +bool ChannelModeKey::IsValid(Anope::string &value) const { if (!value.empty() && value.find(':') == Anope::string::npos && value.find(',') == Anope::string::npos) return true; @@ -796,7 +803,7 @@ Entry::Entry(const Anope::string &m, const Anope::string &fh) : name(m), mask(fh this->host = cidr_ip; - Log(LOG_DEBUG) << "Ban " << this->mask << " has cidr " << this->cidr_len; + Log(LOG_DEBUG) << "Ban " << m << " has cidr " << this->cidr_len; } } catch (const ConvertException &) { } @@ -812,6 +819,14 @@ const Anope::string Entry::GetMask() const return this->mask; } +const Anope::string Entry::GetNUHMask() const +{ + Anope::string n = nick.empty() ? "*" : nick, + u = user.empty() ? "*" : user, + h = host.empty() ? "*" : host; + return n + "!" + u + "@" + h; +} + bool Entry::Matches(User *u, bool full) const { /* First check if this mode has defined any matches (usually for extbans). */ |