diff options
Diffstat (limited to 'src/modules')
52 files changed, 256 insertions, 118 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 5f6f6e30f..6835cb558 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -159,7 +159,7 @@ class SQLConn : public SQLProvider, public EventHandler } } - CullResult cull() + CullResult cull() CXX11_OVERRIDE { this->SQLProvider::cull(); ServerInstance->Modules->DelService(*this); @@ -389,7 +389,7 @@ restart: } } - void submit(SQLQuery *req, const std::string& q) + void submit(SQLQuery *req, const std::string& q) CXX11_OVERRIDE { if (qinprog.q.empty()) { @@ -402,7 +402,7 @@ restart: } } - void submit(SQLQuery *req, const std::string& q, const ParamL& p) + void submit(SQLQuery *req, const std::string& q, const ParamL& p) CXX11_OVERRIDE { std::string res; unsigned int param = 0; @@ -427,7 +427,7 @@ restart: submit(req, res); } - void submit(SQLQuery *req, const std::string& q, const ParamM& p) + void submit(SQLQuery *req, const std::string& q, const ParamM& p) CXX11_OVERRIDE { std::string res; for(std::string::size_type i = 0; i < q.length(); i++) diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index 85709080f..2a38bd3a6 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -22,7 +22,7 @@ class ModuleAbbreviation : public Module { public: - void Prioritize() + void Prioritize() CXX11_OVERRIDE { ServerInstance->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_FIRST); } diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index c6e53f0cf..e99d9dab5 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -352,7 +352,7 @@ class ModuleAlias : public Module ServerInstance->Parser.CallHandler(command, pars, user); } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { // Prioritise after spanningtree so that channel aliases show the alias before the effects. Module* linkmod = ServerInstance->Modules->Find("m_spanningtree.so"); diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 6f9eeb252..cd257eff3 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -21,6 +21,7 @@ #include "inspircd.h" +#include "modules/exemption.h" class AuditoriumMode : public SimpleChannelModeHandler { @@ -33,13 +34,16 @@ class AuditoriumMode : public SimpleChannelModeHandler class ModuleAuditorium : public Module { + CheckExemption::EventProvider exemptionprov; AuditoriumMode aum; bool OpsVisible; bool OpsCanSee; bool OperCanSee; public: - ModuleAuditorium() : aum(this) + ModuleAuditorium() + : exemptionprov(this) + , aum(this) { } @@ -62,7 +66,8 @@ class ModuleAuditorium : public Module if (!memb->chan->IsModeSet(&aum)) return true; - ModResult res = ServerInstance->OnCheckExemption(memb->user, memb->chan, "auditorium-vis"); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (memb->user, memb->chan, "auditorium-vis")); return res.check(OpsVisible && memb->getRank() >= OP_VALUE); } @@ -78,7 +83,8 @@ class ModuleAuditorium : public Module return true; // Can you see the list by permission? - ModResult res = ServerInstance->OnCheckExemption(issuer,memb->chan,"auditorium-see"); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (issuer, memb->chan, "auditorium-see")); if (res.check(OpsCanSee && memb->chan->GetPrefixValue(issuer) >= OP_VALUE)) return true; diff --git a/src/modules/m_bcrypt.cpp b/src/modules/m_bcrypt.cpp index 8a025a0d6..1698b0727 100644 --- a/src/modules/m_bcrypt.cpp +++ b/src/modules/m_bcrypt.cpp @@ -978,7 +978,7 @@ class ModuleBCrypt : public Module bcrypt.rounds = conf->getInt("rounds", 10, 1); } - Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Implements bcrypt hashing", VF_VENDOR); } diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index cd7698d69..6e67cb309 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -21,6 +21,7 @@ #include "inspircd.h" +#include "modules/exemption.h" /** Handles the +B channel mode @@ -33,13 +34,16 @@ class BlockCaps : public SimpleChannelModeHandler class ModuleBlockCAPS : public Module { + CheckExemption::EventProvider exemptionprov; BlockCaps bc; unsigned int percent; unsigned int minlen; char capsmap[256]; public: - ModuleBlockCAPS() : bc(this) + ModuleBlockCAPS() + : exemptionprov(this) + , bc(this) { } @@ -56,7 +60,8 @@ public: return MOD_RES_PASSTHRU; Channel* c = (Channel*)dest; - ModResult res = ServerInstance->OnCheckExemption(user,c,"blockcaps"); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, c, "blockcaps")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 567bdb249..7c961d96a 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -22,6 +22,7 @@ #include "inspircd.h" +#include "modules/exemption.h" /** Handles the +c channel mode */ @@ -33,10 +34,13 @@ class BlockColor : public SimpleChannelModeHandler class ModuleBlockColor : public Module { + CheckExemption::EventProvider exemptionprov; BlockColor bc; public: - ModuleBlockColor() : bc(this) + ModuleBlockColor() + : exemptionprov(this) + , bc(this) { } @@ -50,7 +54,8 @@ class ModuleBlockColor : public Module if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user))) { Channel* c = (Channel*)dest; - ModResult res = ServerInstance->OnCheckExemption(user,c,"blockcolor"); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, c, "blockcolor")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index d2a60275a..56639b298 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -21,6 +21,7 @@ #include "inspircd.h" +#include "modules/exemption.h" typedef insp::flat_map<irc::string, irc::string> censor_t; @@ -42,12 +43,18 @@ class CensorChannel : public SimpleChannelModeHandler class ModuleCensor : public Module { + CheckExemption::EventProvider exemptionprov; censor_t censors; CensorUser cu; CensorChannel cc; public: - ModuleCensor() : cu(this), cc(this) { } + ModuleCensor() + : exemptionprov(this) + , cu(this) + , cc(this) + { + } // format of a config entry is <badword text="shit" replace="poo"> ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE @@ -63,7 +70,8 @@ class ModuleCensor : public Module { Channel* c = (Channel*)dest; active = c->IsModeSet(cc); - ModResult res = ServerInstance->OnCheckExemption(user,c,"censor"); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, c, "censor")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 251773643..3fd9bf250 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -79,6 +79,7 @@ class CommandWebirc : public Command , realhost("cgiirc_realhost", ExtensionItem::EXT_USER, Creator) , realip("cgiirc_realip", ExtensionItem::EXT_USER, Creator) { + allow_empty_last_param = false; works_before_reg = true; this->syntax = "password gateway hostname ip"; } @@ -87,6 +88,14 @@ class CommandWebirc : public Command if(user->registered == REG_ALL) return CMD_FAILURE; + irc::sockets::sockaddrs ipaddr; + if (!irc::sockets::aptosa(parameters[3], 0, ipaddr)) + { + IS_LOCAL(user)->CommandFloodPenalty += 5000; + ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s tried to use WEBIRC but gave an invalid IP address.", user->GetFullRealHost().c_str()); + return CMD_FAILURE; + } + for(CGIHostlist::iterator iter = Hosts.begin(); iter != Hosts.end(); iter++) { if(InspIRCd::Match(user->host, iter->hostmask, ascii_case_insensitive_map) || InspIRCd::MatchCIDR(user->GetIPString(), iter->hostmask, ascii_case_insensitive_map)) @@ -115,6 +124,7 @@ class CommandWebirc : public Command } } + IS_LOCAL(user)->CommandFloodPenalty += 5000; ServerInstance->SNO->WriteGlobalSno('w', "Connecting user %s tried to use WEBIRC, but didn't match any configured webirc blocks.", user->GetFullRealHost().c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index a7bc21557..b642cb933 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -25,6 +25,7 @@ #include "inspircd.h" #include "listmode.h" +#include "modules/exemption.h" /** Handles channel mode +g */ @@ -62,13 +63,15 @@ class ChanFilter : public ListModeBase class ModuleChanFilter : public Module { + CheckExemption::EventProvider exemptionprov; ChanFilter cf; bool hidemask; public: ModuleChanFilter() - : cf(this) + : exemptionprov(this) + , cf(this) { } @@ -84,7 +87,8 @@ class ModuleChanFilter : public Module return MOD_RES_PASSTHRU; Channel* chan = static_cast<Channel*>(dest); - ModResult res = ServerInstance->OnCheckExemption(user,chan,"filter"); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, chan, "filter")); if (!IS_LOCAL(user) || res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_clearchan.cpp b/src/modules/m_clearchan.cpp index 4142f81d1..1b4b8724a 100644 --- a/src/modules/m_clearchan.cpp +++ b/src/modules/m_clearchan.cpp @@ -150,7 +150,7 @@ class ModuleClearChan : public Module { } - void init() + void init() CXX11_OVERRIDE { // Only attached while we are working; don't react to events otherwise ServerInstance->Modules->DetachAll(this); diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 890c799f2..cb3fdac1a 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -89,6 +89,10 @@ class CloakUser : public ModeHandler if (adding) { + // assume this is more correct + if (user->registered != REG_ALL && user->host != user->dhost) + return MODEACTION_DENY; + std::string* cloak = ext.get(user); if (!cloak) @@ -139,7 +143,6 @@ class ModuleCloaking : public Module std::string prefix; std::string suffix; std::string key; - const char* xtab[4]; dynamic_reference<HashProvider> Hash; ModuleCloaking() : cu(this), mode(MODE_OPAQUE), ck(this), Hash(this, "hash/md5") @@ -286,7 +289,7 @@ class ModuleCloaking : public Module return MOD_RES_PASSTHRU; } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { /* Needs to be after m_banexception etc. */ ServerInstance->Modules->SetPriority(this, I_OnCheckBan, PRIORITY_LAST); @@ -343,11 +346,14 @@ class ModuleCloaking : public Module { std::string chost; + irc::sockets::sockaddrs hostip; + bool host_is_ip = irc::sockets::aptosa(host, ip.port(), hostip) && hostip == ip; + switch (mode) { case MODE_HALF_CLOAK: { - if (ipstr != host) + if (!host_is_ip) chost = prefix + SegmentCloak(host, 1, 6) + LastTwoDomainParts(host); if (chost.empty() || chost.length() > 50) chost = SegmentIP(ip, false); diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index b22dbdf4d..bd8d89dc9 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -78,7 +78,7 @@ class ModuleConnJoin : public Module defdelay = tag->getInt("delay", 0, 0, 60); } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { ServerInstance->Modules->SetPriority(this, I_OnPostConnect, PRIORITY_LAST); } diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index 7a8d66ae7..0b708641e 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -25,7 +25,7 @@ class ModuleModesOnConnect : public Module { public: - void Prioritize() + void Prioritize() CXX11_OVERRIDE { // for things like +x on connect, important, otherwise we have to resort to config order (bleh) -- w00t ServerInstance->Modules->SetPriority(this, I_OnUserConnect, PRIORITY_FIRST); diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index fcb4b09ed..e0f9717c4 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -95,7 +95,7 @@ class ModuleConnectBan : public Module } } - void OnGarbageCollect() + void OnGarbageCollect() CXX11_OVERRIDE { ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Clearing map."); connects.clear(); diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 73ecd02a6..752a0d7a5 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -70,6 +70,14 @@ class DNSBLResolver : public DNS::Request if (!ans_record) return; + // All replies should be in 127.0.0.0/8 + if (ans_record->rdata.compare(0, 4, "127.") != 0) + { + ServerInstance->SNO->WriteGlobalSno('a', "DNSBL: %s returned address outside of acceptable subnet 127.0.0.0/8: %s", ConfEntry->domain.c_str(), ans_record->rdata.c_str()); + ConfEntry->stats_misses++; + return; + } + int i = countExt.get(them); if (i) countExt.set(them, i - 1); @@ -175,7 +183,7 @@ class DNSBLResolver : public DNS::Request if (ServerInstance->XLines->AddLine(zl,NULL)) { std::string timestr = InspIRCd::TimeString(zl->expiry); - ServerInstance->SNO->WriteGlobalSno('x',"Z:line added due to DNSBL match on *@%s to expire on %s: %s", + ServerInstance->SNO->WriteGlobalSno('x',"Z:line added due to DNSBL match on %s to expire on %s: %s", them->GetIPString().c_str(), timestr.c_str(), reason.c_str()); ServerInstance->XLines->ApplyLines(); } diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index 2884385fb..0c67037f0 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -19,6 +19,7 @@ #include "inspircd.h" #include "listmode.h" +#include "modules/exemption.h" /** Handles channel mode +X */ @@ -68,11 +69,15 @@ class ExemptChanOps : public ListModeBase } }; -class ExemptHandler : public HandlerBase3<ModResult, User*, Channel*, const std::string&> +class ExemptHandler : public CheckExemption::EventListener { public: ExemptChanOps ec; - ExemptHandler(Module* me) : ec(me) {} + ExemptHandler(Module* me) + : CheckExemption::EventListener(me) + , ec(me) + { + } PrefixMode* FindMode(const std::string& mid) { @@ -83,7 +88,7 @@ class ExemptHandler : public HandlerBase3<ModResult, User*, Channel*, const std: return mh ? mh->IsPrefixMode() : NULL; } - ModResult Call(User* user, Channel* chan, const std::string& restriction) + ModResult OnCheckExemption(User* user, Channel* chan, const std::string& restriction) CXX11_OVERRIDE { unsigned int mypfx = chan->GetPrefixValue(user); std::string minmode; @@ -108,7 +113,7 @@ class ExemptHandler : public HandlerBase3<ModResult, User*, Channel*, const std: if (mh || minmode == "*") return MOD_RES_DENY; - return ServerInstance->HandleOnCheckExemption.Call(user, chan, restriction); + return MOD_RES_PASSTHRU; } }; @@ -121,16 +126,6 @@ class ModuleExemptChanOps : public Module { } - void init() CXX11_OVERRIDE - { - ServerInstance->OnCheckExemption = &eh; - } - - ~ModuleExemptChanOps() - { - ServerInstance->OnCheckExemption = &ServerInstance->HandleOnCheckExemption; - } - Version GetVersion() CXX11_OVERRIDE { return Version("Provides the ability to allow channel operators to be exempt from certain modes.",VF_VENDOR); diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index bd19a60ba..0badd1377 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -176,7 +176,7 @@ class ModuleFilter : public Module ExemptTargetSet exemptednicks; ModuleFilter(); - CullResult cull(); + CullResult cull() CXX11_OVERRIDE; ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE; FilterResult* FilterMatch(User* user, const std::string &text, int flags); bool DeleteFilter(const std::string &freeform); diff --git a/src/modules/m_flashpolicyd.cpp b/src/modules/m_flashpolicyd.cpp index 8f847e111..38b7be73f 100644 --- a/src/modules/m_flashpolicyd.cpp +++ b/src/modules/m_flashpolicyd.cpp @@ -146,7 +146,7 @@ class ModuleFlashPD : public Module </cross-domain-policy>"; } - CullResult cull() + CullResult cull() CXX11_OVERRIDE { for (insp::intrusive_list<FlashPDSocket>::const_iterator i = sockets.begin(); i != sockets.end(); ++i) { diff --git a/src/modules/m_hostcycle.cpp b/src/modules/m_hostcycle.cpp index b33c101ef..621f06a27 100644 --- a/src/modules/m_hostcycle.cpp +++ b/src/modules/m_hostcycle.cpp @@ -40,6 +40,8 @@ class ModuleHostCycle : public Module FOREACH_MOD(OnBuildNeighborList, (user, include_chans, exceptions)); + // Users shouldn't see themselves quitting when host cycling + exceptions.erase(user); for (std::map<User*,bool>::iterator i = exceptions.begin(); i != exceptions.end(); ++i) { LocalUser* u = IS_LOCAL(i->first); diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 6055d1f77..35ae9abe5 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -224,7 +224,7 @@ class HttpServerSocket : public BufferedSocket, public Timer, public insp::intru WriteData("\r\n"); } - void OnDataReady() + void OnDataReady() CXX11_OVERRIDE { if (InternalState == HTTP_SERVE_RECV_POSTDATA) { @@ -415,7 +415,7 @@ class ModuleHttpServer : public Module return MOD_RES_ALLOW; } - void OnUnloadModule(Module* mod) + void OnUnloadModule(Module* mod) CXX11_OVERRIDE { for (insp::intrusive_list<HttpServerSocket>::const_iterator i = sockets.begin(); i != sockets.end(); ) { diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index 6fd7f4050..11c82c031 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -81,8 +81,8 @@ class ModuleHttpConfig : public Module, public HTTPRequestEventListener for (ConfigDataHash::iterator x = ServerInstance->Config->config_data.begin(); x != ServerInstance->Config->config_data.end(); ++x) { data << "<" << x->first << " "; - ConfigTag* tag = x->second; - for (std::vector<KeyVal>::const_iterator j = tag->getItems().begin(); j != tag->getItems().end(); j++) + const ConfigItems& items = x->second->getItems(); + for (ConfigItems::const_iterator j = items.begin(); j != items.end(); j++) { data << Sanitize(j->first) << "="" << Sanitize(j->second) << "" "; } diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 11fad4b18..62ae0c204 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -211,7 +211,7 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener data << "<server>"; data << "<servername>" << b->servername << "</servername>"; data << "<parentname>" << b->parentname << "</parentname>"; - data << "<gecos>" << b->gecos << "</gecos>"; + data << "<gecos>" << Sanitize(b->gecos) << "</gecos>"; data << "<usercount>" << b->usercount << "</usercount>"; // This is currently not implemented, so, commented out. // data << "<opercount>" << b->opercount << "</opercount>"; diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp index 9e94e556d..543fb49a4 100644 --- a/src/modules/m_ircv3.cpp +++ b/src/modules/m_ircv3.cpp @@ -169,7 +169,7 @@ class ModuleIRCv3 : public Module, public AccountEventListener last_excepts.clear(); } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { ServerInstance->Modules->SetPriority(this, I_OnUserJoin, PRIORITY_LAST); } diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp index 6cec05a18..26ff4cffc 100644 --- a/src/modules/m_md5.cpp +++ b/src/modules/m_md5.cpp @@ -61,23 +61,13 @@ class MD5Provider : public HashProvider } while (--words); } - void MD5Init(MD5Context *ctx, unsigned int* ikey = NULL) + void MD5Init(MD5Context *ctx) { /* These are the defaults for md5 */ - if (!ikey) - { - ctx->buf[0] = 0x67452301; - ctx->buf[1] = 0xefcdab89; - ctx->buf[2] = 0x98badcfe; - ctx->buf[3] = 0x10325476; - } - else - { - ctx->buf[0] = ikey[0]; - ctx->buf[1] = ikey[1]; - ctx->buf[2] = ikey[2]; - ctx->buf[3] = ikey[3]; - } + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; ctx->bytes[0] = 0; ctx->bytes[1] = 0; @@ -236,10 +226,10 @@ class MD5Provider : public HashProvider } - void MyMD5(void *dest, void *orig, int len, unsigned int* ikey) + void MyMD5(void *dest, void *orig, int len) { MD5Context context; - MD5Init(&context, ikey); + MD5Init(&context); MD5Update(&context, (const unsigned char*)orig, len); MD5Final((unsigned char*)dest, &context); } @@ -248,7 +238,7 @@ class MD5Provider : public HashProvider std::string GenerateRaw(const std::string& data) { char res[16]; - MyMD5(res, (void*)data.data(), data.length(), NULL); + MyMD5(res, (void*)data.data(), data.length()); return std::string(res, 16); } diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 7323605cb..9d119b6c3 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -24,6 +24,7 @@ #include "inspircd.h" +#include "modules/exemption.h" /** Holds flood settings and state for mode +f */ @@ -103,12 +104,14 @@ class MsgFlood : public ParamMode<MsgFlood, SimpleExtItem<floodsettings> > class ModuleMsgFlood : public Module { + CheckExemption::EventProvider exemptionprov; MsgFlood mf; public: ModuleMsgFlood() - : mf(this) + : exemptionprov(this) + , mf(this) { } @@ -121,7 +124,9 @@ class ModuleMsgFlood : public Module if ((!IS_LOCAL(user)) || !dest->IsModeSet(mf)) return MOD_RES_PASSTHRU; - if (ServerInstance->OnCheckExemption(user,dest,"flood") == MOD_RES_ALLOW) + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, dest, "flood")); + if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; floodsettings *f = mf.ext.get(dest); @@ -150,7 +155,7 @@ class ModuleMsgFlood : public Module return MOD_RES_PASSTHRU; } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { // we want to be after all modules that might deny the message (e.g. m_muteban, m_noctcp, m_blockcolor, etc.) ServerInstance->Modules->SetPriority(this, I_OnUserPreMessage, PRIORITY_LAST); diff --git a/src/modules/m_mlock.cpp b/src/modules/m_mlock.cpp index d3ab5b9fd..2a0410bed 100644 --- a/src/modules/m_mlock.cpp +++ b/src/modules/m_mlock.cpp @@ -34,7 +34,7 @@ class ModuleMLock : public Module return Version("Implements the ability to have server-side MLOCK enforcement.", VF_VENDOR); } - ModResult OnRawMode(User* source, Channel* channel, ModeHandler* mh, const std::string& parameter, bool adding) + ModResult OnRawMode(User* source, Channel* channel, ModeHandler* mh, const std::string& parameter, bool adding) CXX11_OVERRIDE { if (!channel) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp index 7a86c9e3c..7f2687d66 100644 --- a/src/modules/m_namedmodes.cpp +++ b/src/modules/m_namedmodes.cpp @@ -124,7 +124,7 @@ class ModuleNamedModes : public Module return Version("Provides the ability to manipulate modes via long names.",VF_VENDOR); } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { ServerInstance->Modules->SetPriority(this, I_OnPreMode, PRIORITY_FIRST); } diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index abb3cdfaf..a4a87f691 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -19,6 +19,7 @@ #include "inspircd.h" +#include "modules/exemption.h" // The number of seconds nickname changing will be blocked for. static unsigned int duration; @@ -121,11 +122,13 @@ class NickFlood : public ParamMode<NickFlood, SimpleExtItem<nickfloodsettings> > class ModuleNickFlood : public Module { + CheckExemption::EventProvider exemptionprov; NickFlood nf; public: ModuleNickFlood() - : nf(this) + : exemptionprov(this) + , nf(this) { } @@ -145,7 +148,7 @@ class ModuleNickFlood : public Module nickfloodsettings *f = nf.ext.get(channel); if (f) { - res = ServerInstance->OnCheckExemption(user,channel,"nickflood"); + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, channel, "nickflood")); if (res == MOD_RES_ALLOW) continue; @@ -184,7 +187,7 @@ class ModuleNickFlood : public Module nickfloodsettings *f = nf.ext.get(channel); if (f) { - res = ServerInstance->OnCheckExemption(user,channel,"nickflood"); + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, channel, "nickflood")); if (res == MOD_RES_ALLOW) return; diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 35845c8d8..6e22a69bb 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -157,7 +157,7 @@ class ModuleNickLock : public Module return MOD_RES_PASSTHRU; } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { Module *nflood = ServerInstance->Modules->Find("m_nickflood.so"); ServerInstance->Modules->SetPriority(this, I_OnUserPreNick, PRIORITY_BEFORE, nflood); diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 49b53ee95..9dd9bf852 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -20,6 +20,7 @@ #include "inspircd.h" +#include "modules/exemption.h" class NoCTCP : public SimpleChannelModeHandler { @@ -29,11 +30,13 @@ class NoCTCP : public SimpleChannelModeHandler class ModuleNoCTCP : public Module { + CheckExemption::EventProvider exemptionprov; NoCTCP nc; public: ModuleNoCTCP() - : nc(this) + : exemptionprov(this) + , nc(this) { } @@ -50,7 +53,8 @@ class ModuleNoCTCP : public Module if ((text.empty()) || (text[0] != '\001') || (!strncmp(text.c_str(),"\1ACTION ",8))) return MOD_RES_PASSTHRU; - ModResult res = ServerInstance->OnCheckExemption(user,c,"noctcp"); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, c, "noctcp")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index d4da3e951..c6de17e89 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -20,6 +20,7 @@ #include "inspircd.h" +#include "modules/exemption.h" class NoNicks : public SimpleChannelModeHandler { @@ -29,10 +30,13 @@ class NoNicks : public SimpleChannelModeHandler class ModuleNoNickChange : public Module { + CheckExemption::EventProvider exemptionprov; NoNicks nn; bool override; public: - ModuleNoNickChange() : nn(this) + ModuleNoNickChange() + : exemptionprov(this) + , nn(this) { } @@ -52,7 +56,8 @@ class ModuleNoNickChange : public Module { Channel* curr = (*i)->chan; - ModResult res = ServerInstance->OnCheckExemption(user,curr,"nonick"); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, curr, "nonick")); if (res == MOD_RES_ALLOW) continue; diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 3d6d0bb09..ec5be9517 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -20,6 +20,7 @@ #include "inspircd.h" +#include "modules/exemption.h" class NoNotice : public SimpleChannelModeHandler { @@ -29,11 +30,13 @@ class NoNotice : public SimpleChannelModeHandler class ModuleNoNotice : public Module { + CheckExemption::EventProvider exemptionprov; NoNotice nt; public: ModuleNoNotice() - : nt(this) + : exemptionprov(this) + , nt(this) { } @@ -50,7 +53,7 @@ class ModuleNoNotice : public Module Channel* c = (Channel*)dest; if (!c->GetExtBanStatus(user, 'T').check(!c->IsModeSet(nt))) { - res = ServerInstance->OnCheckExemption(user,c,"nonotice"); + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, c, "nonotice")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; else diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 9465a51e5..76e66bdc2 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -150,7 +150,7 @@ class ModuleOjoin : public Module return MOD_RES_DENY; } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { ServerInstance->Modules->SetPriority(this, I_OnUserPreJoin, PRIORITY_FIRST); } diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp index d66f99450..b355047ee 100644 --- a/src/modules/m_operprefix.cpp +++ b/src/modules/m_operprefix.cpp @@ -72,7 +72,7 @@ class ModuleOperPrefixMode : public Module return MOD_RES_PASSTHRU; } - void OnPostJoin(Membership* memb) + void OnPostJoin(Membership* memb) CXX11_OVERRIDE { if ((!IS_LOCAL(memb->user)) || (!memb->user->IsOper()) || (memb->user->IsModeSet(hideopermode))) return; @@ -105,7 +105,7 @@ class ModuleOperPrefixMode : public Module return Version("Gives opers cmode +y which provides a staff prefix.", VF_VENDOR); } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { // m_opermodes may set +H on the oper to hide him, we don't want to set the oper prefix in that case Module* opermodes = ServerInstance->Modules->Find("m_opermodes.so"); diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 9cfc3aed0..fd09dd6ec 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -121,7 +121,8 @@ class ModuleOverride : public Module if (source->IsOper() && CanOverride(source,"KICK")) { // If the kicker's status is less than the target's, or the kicker's status is less than or equal to voice - if ((memb->chan->GetPrefixValue(source) < memb->getRank()) || (memb->chan->GetPrefixValue(source) <= VOICE_VALUE)) + if ((memb->chan->GetPrefixValue(source) < memb->getRank()) || (memb->chan->GetPrefixValue(source) <= VOICE_VALUE) || + (memb->chan->GetPrefixValue(source) == HALFOP_VALUE && memb->getRank() == HALFOP_VALUE)) { ServerInstance->SNO->WriteGlobalSno('v',source->nick+" used oper override to kick "+memb->user->nick+" on "+memb->chan->name+" ("+reason+")"); return MOD_RES_ALLOW; diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 9e77bd60e..0f2a2ef6f 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -244,6 +244,10 @@ public: mode->OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, c, par, true); } } + + // We always apply the permchannels mode to permanent channels. + par.clear(); + p.OnModeChange(ServerInstance->FakeClient, ServerInstance->FakeClient, c, par, true); } } } @@ -269,7 +273,7 @@ public: dirty = false; } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { // XXX: Load the DB here because the order in which modules are init()ed at boot is // alphabetical, this means we must wait until all modules have done their init() diff --git a/src/modules/m_repeat.cpp b/src/modules/m_repeat.cpp index 21bca0f3f..9715fcf6f 100644 --- a/src/modules/m_repeat.cpp +++ b/src/modules/m_repeat.cpp @@ -18,6 +18,7 @@ #include "inspircd.h" +#include "modules/exemption.h" class ChannelSettings { @@ -339,10 +340,15 @@ class RepeatMode : public ParamMode<RepeatMode, SimpleExtItem<ChannelSettings> > class RepeatModule : public Module { + CheckExemption::EventProvider exemptionprov; RepeatMode rm; public: - RepeatModule() : rm(this) {} + RepeatModule() + : exemptionprov(this) + , rm(this) + { + } void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { @@ -363,7 +369,9 @@ class RepeatModule : public Module if (!memb) return MOD_RES_PASSTHRU; - if (ServerInstance->OnCheckExemption(user, chan, "repeat") == MOD_RES_ALLOW) + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, chan, "repeat")); + if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; if (rm.MatchLine(memb, settings, text)) diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 97fbf169a..e77a00b6d 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -333,7 +333,7 @@ class ModuleRLine : public Module } } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { Module* mod = ServerInstance->Modules->Find("m_cgiirc.so"); ServerInstance->Modules->SetPriority(this, I_OnUserRegister, PRIORITY_AFTER, mod); diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 6288f5862..394cea722 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -96,7 +96,7 @@ class ModuleSaMode : public Module return MOD_RES_PASSTHRU; } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { Module *override = ServerInstance->Modules->Find("m_override.so"); ServerInstance->Modules->SetPriority(this, I_OnPreMode, PRIORITY_BEFORE, override); diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 2b247a198..6ad9d77b7 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -153,10 +153,63 @@ class SaslAuthenticator SaslResult result; bool state_announced; + /* taken from m_services_account */ + static bool ReadCGIIRCExt(const char* extname, User* user, std::string& out) + { + ExtensionItem* wiext = ServerInstance->Extensions.GetItem(extname); + if (!wiext) + return false; + + if (wiext->creator->ModuleSourceFile != "m_cgiirc.so") + return false; + + StringExtItem* stringext = static_cast<StringExtItem*>(wiext); + std::string* addr = stringext->get(user); + if (!addr) + return false; + + out = *addr; + return true; + } + + + void SendHostIP() + { + std::string host, ip; + + if (!ReadCGIIRCExt("cgiirc_webirc_hostname", user, host)) + { + host = user->host; + } + if (!ReadCGIIRCExt("cgiirc_webirc_ip", user, ip)) + { + ip = user->GetIPString(); + } + else + { + /* IP addresses starting with a : on irc are a Bad Thing (tm) */ + if (ip.c_str()[0] == ':') + ip.insert(ip.begin(),1,'0'); + } + + parameterlist params; + params.push_back(sasl_target); + params.push_back("SASL"); + params.push_back(user->uuid); + params.push_back("*"); + params.push_back("H"); + params.push_back(host); + params.push_back(ip); + + SendSASL(params); + } + public: SaslAuthenticator(User* user_, const std::string& method) : user(user_), state(SASL_INIT), state_announced(false) { + SendHostIP(); + parameterlist params; params.push_back(user->uuid); params.push_back("*"); @@ -164,7 +217,7 @@ class SaslAuthenticator params.push_back(method); LocalUser* localuser = IS_LOCAL(user); - if (method == "EXTERNAL" && localuser) + if (localuser) { std::string fp = SSLClientCert::GetFingerprint(&localuser->eh); @@ -287,6 +340,7 @@ class CommandAuthenticate : public Command : Command(Creator, "AUTHENTICATE", 1), authExt(ext), cap(Cap) { works_before_reg = true; + allow_empty_last_param = false; } CmdResult Handle (const std::vector<std::string>& parameters, User *user) @@ -295,6 +349,9 @@ class CommandAuthenticate : public Command if (!cap.get(user)) return CMD_FAILURE; + if (parameters[0].find(' ') != std::string::npos || parameters[0][0] == ':') + return CMD_FAILURE; + SaslAuthenticator *sasl = authExt.get(user); if (!sasl) authExt.set(user, new SaslAuthenticator(user, parameters[0])); @@ -378,7 +435,7 @@ class ModuleSASL : public Module servertracker.Reset(); } - ModResult OnUserRegister(LocalUser *user) CXX11_OVERRIDE + void OnUserConnect(LocalUser *user) CXX11_OVERRIDE { SaslAuthenticator *sasl_ = authExt.get(user); if (sasl_) @@ -386,8 +443,6 @@ class ModuleSASL : public Module sasl_->Abort(); authExt.unset(user); } - - return MOD_RES_PASSTHRU; } void OnDecodeMetaData(Extensible* target, const std::string& extname, const std::string& extdata) CXX11_OVERRIDE diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index e97e1b02f..1ff206ed1 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -24,6 +24,7 @@ #include "inspircd.h" #include "modules/account.h" +#include "modules/exemption.h" /** Channel mode +r - mark a channel as identified */ @@ -139,6 +140,7 @@ class AccountExtItemImpl : public AccountExtItem class ModuleServicesAccount : public Module, public Whois::EventListener { + CheckExemption::EventProvider exemptionprov; AChannel_R m1; AChannel_M m2; AUser_R m3; @@ -149,6 +151,7 @@ class ModuleServicesAccount : public Module, public Whois::EventListener public: ModuleServicesAccount() : Whois::EventListener(this) + , exemptionprov(this) , m1(this), m2(this), m3(this), m4(this), m5(this) , accountname(this) , checking_ban(false) @@ -196,7 +199,8 @@ class ModuleServicesAccount : public Module, public Whois::EventListener if (target_type == TYPE_CHANNEL) { Channel* c = (Channel*)dest; - ModResult res = ServerInstance->OnCheckExemption(user,c,"regmoderated"); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, c, "regmoderated")); if (c->IsModeSet(m2) && !is_registered && res != MOD_RES_ALLOW) { diff --git a/src/modules/m_sha1.cpp b/src/modules/m_sha1.cpp index 5926e4926..798539d91 100644 --- a/src/modules/m_sha1.cpp +++ b/src/modules/m_sha1.cpp @@ -190,7 +190,7 @@ class ModuleSHA1 : public Module big_endian = (htonl(1337) == 1337); } - Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Implements SHA-1 hashing", VF_VENDOR); } diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 022726524..28faf898b 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -191,7 +191,7 @@ class ModuleShun : public Module ServerInstance->XLines->UnregisterFactory(&f); } - void Prioritize() + void Prioritize() CXX11_OVERRIDE { Module* alias = ServerInstance->Modules->Find("m_alias.so"); ServerInstance->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_BEFORE, alias); diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 46c21b4e9..00cbd3dcd 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -168,8 +168,8 @@ class ModuleSpanningTree : public Module void OnUnloadModule(Module* mod) CXX11_OVERRIDE; ModResult OnAcceptConnection(int newsock, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE; void OnMode(User* source, User* u, Channel* c, const Modes::ChangeList& modes, ModeParser::ModeProcessFlag processflags, const std::string& output_mode) CXX11_OVERRIDE; - CullResult cull(); + CullResult cull() CXX11_OVERRIDE; ~ModuleSpanningTree(); Version GetVersion() CXX11_OVERRIDE; - void Prioritize(); + void Prioritize() CXX11_OVERRIDE; }; diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h index e7fed5475..b0609005c 100644 --- a/src/modules/m_spanningtree/protocolinterface.h +++ b/src/modules/m_spanningtree/protocolinterface.h @@ -37,7 +37,7 @@ class SpanningTreeProtocolInterface : public ProtocolInterface void SendMetaData(Channel* chan, const std::string& key, const std::string& data) CXX11_OVERRIDE; void SendMetaData(const std::string& key, const std::string& data) CXX11_OVERRIDE; void SendSNONotice(char snomask, const std::string& text) CXX11_OVERRIDE; - void SendMessage(Channel* target, char status, const std::string& text, MessageType msgtype); - void SendMessage(User* target, const std::string& text, MessageType msgtype); - void GetServerList(ServerList& sl); + void SendMessage(Channel* target, char status, const std::string& text, MessageType msgtype) CXX11_OVERRIDE; + void SendMessage(User* target, const std::string& text, MessageType msgtype) CXX11_OVERRIDE; + void GetServerList(ServerList& sl) CXX11_OVERRIDE; }; diff --git a/src/modules/m_spanningtree/servercommand.h b/src/modules/m_spanningtree/servercommand.h index 07dfc4898..ee7766764 100644 --- a/src/modules/m_spanningtree/servercommand.h +++ b/src/modules/m_spanningtree/servercommand.h @@ -43,7 +43,7 @@ class ServerCommand : public CommandBase void RegisterService() CXX11_OVERRIDE; virtual CmdResult Handle(User* user, std::vector<std::string>& parameters) = 0; - virtual RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters); + virtual RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters) CXX11_OVERRIDE; /** * Extract the TS from a string. diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index b7e9ee9d9..f75adf54c 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -219,7 +219,7 @@ class TreeServer : public Server */ void OnPong() { pingtimer.OnPong(); } - CullResult cull(); + CullResult cull() CXX11_OVERRIDE; /** Destructor, deletes ServerUser unless IsRoot() */ diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 4887623c1..3571f2816 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -200,7 +200,7 @@ class TreeSocket : public BufferedSocket */ void CleanNegotiationInfo(); - CullResult cull(); + CullResult cull() CXX11_OVERRIDE; /** Destructor */ ~TreeSocket(); @@ -216,7 +216,7 @@ class TreeSocket : public BufferedSocket * to server docs on the inspircd.org site, the other side * will then send back its own server string. */ - void OnConnected(); + void OnConnected() CXX11_OVERRIDE; /** Handle socket error event */ @@ -270,7 +270,7 @@ class TreeSocket : public BufferedSocket /** This function is called when we receive data from a remote * server. */ - void OnDataReady(); + void OnDataReady() CXX11_OVERRIDE; /** Send one or more complete lines down the socket */ @@ -299,10 +299,10 @@ class TreeSocket : public BufferedSocket /** Handle socket timeout from connect() */ - void OnTimeout(); + void OnTimeout() CXX11_OVERRIDE; /** Handle server quit on close */ - void Close(); + void Close() CXX11_OVERRIDE; /** Fixes messages coming from old servers so the new command handlers understand them */ diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index a2f7212f6..f262f9a48 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -108,7 +108,7 @@ class SpanningTreeUtilities : public classbase /** Prepare for class destruction */ - CullResult cull(); + CullResult cull() CXX11_OVERRIDE; /** Destroy class and free listeners etc */ diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 592aeda90..6ad32bfc1 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -20,6 +20,7 @@ #include "inspircd.h" +#include "modules/exemption.h" /** Handles channel mode +S */ @@ -40,11 +41,15 @@ class UserStripColor : public SimpleUserModeHandler class ModuleStripColor : public Module { + CheckExemption::EventProvider exemptionprov; ChannelStripColor csc; UserStripColor usc; public: - ModuleStripColor() : csc(this), usc(this) + ModuleStripColor() + : exemptionprov(this) + , csc(this) + , usc(this) { } @@ -67,7 +72,8 @@ class ModuleStripColor : public Module else if (target_type == TYPE_CHANNEL) { Channel* t = (Channel*)dest; - ModResult res = ServerInstance->OnCheckExemption(user,t,"stripcolor"); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, t, "stripcolor")); if (res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; @@ -91,12 +97,13 @@ class ModuleStripColor : public Module if (!IS_LOCAL(user)) return; - bool active = channel->GetExtBanStatus(user, 'S').check(!user->IsModeSet(csc)) - && ServerInstance->OnCheckExemption(user, channel, "stripcolor") != MOD_RES_ALLOW; - - if (active) + if (channel->GetExtBanStatus(user, 'S').check(!user->IsModeSet(csc))) { - InspIRCd::StripColor(partmessage); + ModResult res; + FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, channel, "stripcolor")); + + if (res != MOD_RES_ALLOW) + InspIRCd::StripColor(partmessage); } } diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 874e6440f..44c6c4c4f 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -218,7 +218,7 @@ class ModuleTimedBans : public Module } } - void OnChannelDelete(Channel* chan) + void OnChannelDelete(Channel* chan) CXX11_OVERRIDE { // Remove all timed bans affecting the channel from internal bookkeeping TimedBanList.erase(std::remove_if(TimedBanList.begin(), TimedBanList.end(), ChannelMatcher(chan)), TimedBanList.end()); |