From 8e7b742ec73a0a0c5a9ae1dc4ce246ebbe37c737 Mon Sep 17 00:00:00 2001 From: DukePyrolator Date: Sun, 14 Sep 2014 11:11:22 +0200 Subject: added missing support for operonly and silentoperonly in os_defcon --- modules/commands/os_defcon.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'modules/commands/os_defcon.cpp') diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index c5074fd44..a618693d6 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -439,7 +439,16 @@ class OSDefcon : public Module EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector ¶ms) anope_override { - if (command->name == "nickserv/register" || command->name == "nickserv/group") + if (Config.Check(DEFCON_OPER_ONLY) && !source.IsOper()) + { + source.Reply(_("Services are in DefCon mode, please try again later.")); + return EVENT_STOP; + } + else if (DConfig.Check(DEFCON_SILENT_OPER_ONLY) && !source.IsOper()) + { + return EVENT_STOP; + } + else if (command->name == "nickserv/register" || command->name == "nickserv/group") { if (DConfig.Check(DEFCON_NO_NEW_NICKS)) { -- cgit From 4c2bf72cb642fc03de3eaf2591d84cb622609cb2 Mon Sep 17 00:00:00 2001 From: DukePyrolator Date: Sun, 14 Sep 2014 11:12:54 +0200 Subject: fixed typo in the last commit --- modules/commands/os_defcon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/commands/os_defcon.cpp') diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index a618693d6..247938049 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -439,7 +439,7 @@ class OSDefcon : public Module EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector ¶ms) anope_override { - if (Config.Check(DEFCON_OPER_ONLY) && !source.IsOper()) + if (DConfig.Check(DEFCON_OPER_ONLY) && !source.IsOper()) { source.Reply(_("Services are in DefCon mode, please try again later.")); return EVENT_STOP; -- cgit From 0cd3bfa24fccea79a5055bcd12d6aa607ecc635e Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 14 Oct 2014 18:58:55 -0400 Subject: Fix module event prioritization which was broken with the newer auto-attach event stuff. Also remove logically dead code from os_defcon, and make os_defcon akill similar masks to os_session when enforcing session akills. Fixes #1618 which relies on os_session to be prioritized before os_defcon. --- modules/commands/os_defcon.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'modules/commands/os_defcon.cpp') diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index 247938049..da9621cfd 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -496,11 +496,6 @@ class OSDefcon : public Module XLine x("*@" + u->host, OperServ ? OperServ->nick : "defcon", Anope::CurTime + DConfig.akillexpire, DConfig.akillreason, XLineManager::GenerateUID()); akills->Send(NULL, &x); } - if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) - { - u->Kill(OperServ ? OperServ->nick : "", DConfig.akillreason); - return; - } if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) { @@ -529,9 +524,9 @@ class OSDefcon : public Module ++session->hits; if (akills && DConfig.max_session_kill && session->hits >= DConfig.max_session_kill) { - XLine x("*@" + u->host, OperServ ? OperServ->nick : "", Anope::CurTime + DConfig.session_autokill_expiry, "Defcon session limit exceeded", XLineManager::GenerateUID()); + XLine x("*@" + session->addr.mask(), OperServ ? OperServ->nick : "", Anope::CurTime + DConfig.session_autokill_expiry, "Defcon session limit exceeded", XLineManager::GenerateUID()); akills->Send(NULL, &x); - Log(OperServ, "akill/defcon") << "[DEFCON] Added a temporary AKILL for \002*@" << u->host << "\002 due to excessive connections"; + Log(OperServ, "akill/defcon") << "[DEFCON] Added a temporary AKILL for \002*@" << session->addr.mask() << "\002 due to excessive connections"; } else { -- cgit From c4460784c2b3695b9f3a8073fc61712e9f804573 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 4 Nov 2014 01:36:27 -0500 Subject: Allow mlock to be enforced when unsetting defcon modes --- modules/commands/os_defcon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/commands/os_defcon.cpp') diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index da9621cfd..71ee59b91 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -577,7 +577,7 @@ static void runDefCon() { Log(OperServ, "operserv/defcon") << "DEFCON: setting " << newmodes << " on all channels"; for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it) - it->second->SetModes(OperServ, false, "%s", newmodes.c_str()); + it->second->SetModes(OperServ, true, "%s", newmodes.c_str()); } } } -- cgit From afffeb0a1d49c1ac8f06ac9850929a41a52cbc7e Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 5 Dec 2014 17:27:08 -0500 Subject: Update Kill() calls to pass source pointer instead of name --- modules/commands/os_defcon.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/commands/os_defcon.cpp') diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index 71ee59b91..90cd877b7 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -499,7 +499,7 @@ class OSDefcon : public Module if (DConfig.Check(DEFCON_NO_NEW_CLIENTS) || DConfig.Check(DEFCON_AKILL_NEW_CLIENTS)) { - u->Kill(OperServ ? OperServ->nick : "", DConfig.akillreason); + u->Kill(OperServ, DConfig.akillreason); return; } @@ -530,7 +530,7 @@ class OSDefcon : public Module } else { - u->Kill(OperServ ? OperServ->nick : "", "Defcon session limit exceeded"); + u->Kill(OperServ, "Defcon session limit exceeded"); } } } -- cgit