diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-08-06 13:20:00 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-08-06 13:20:00 +0200 |
commit | 0b1c84c54185545b62673ad098fe0d3d19c22570 (patch) | |
tree | 3d04232a8a2c8de35f1935acac3e732b651163cc /src | |
parent | 3f6f010fc878ff56c48104b936c5b3d363aafa04 (diff) |
m_exemptchanops Fix parameter validation
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_exemptchanops.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index 43ae21a1c..2d06b73a0 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -29,9 +29,23 @@ class ExemptChanOps : public ListModeBase bool ValidateParam(User* user, Channel* chan, std::string &word) { - if (!ServerInstance->Modes->FindMode(word, MODETYPE_CHANNEL)) + std::string::size_type p = word.find(':'); + if (p == std::string::npos) { - user->WriteNumeric(955, "%s %s :Mode doesn't exist", chan->name.c_str(), word.c_str()); + user->WriteNumeric(955, "%s %s :Invalid exemptchanops entry, format is <restriction>:<prefix>", chan->name.c_str(), word.c_str()); + return false; + } + + std::string restriction = word.substr(0, p); + // If there is a '-' in the restriction string ignore it and everything after it + // to support "auditorium-vis" and "auditorium-see" in m_auditorium + p = restriction.find('-'); + if (p != std::string::npos) + restriction.erase(p); + + if (!ServerInstance->Modes->FindMode(restriction, MODETYPE_CHANNEL)) + { + user->WriteNumeric(955, "%s %s :Unknown restriction", chan->name.c_str(), restriction.c_str()); return false; } |