From ac984af11af199bceeb112ec4de4d06d1b0c9ac6 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 29 Dec 2015 14:04:45 -0500 Subject: Move CanAdd() check to after mask sanitization as it will remove other entries that are considered "covered by" the new mask --- modules/commands/os_sxline.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp index 3fde89871..eb3d570ec 100644 --- a/modules/commands/os_sxline.cpp +++ b/modules/commands/os_sxline.cpp @@ -354,9 +354,7 @@ class CommandOSSNLine : public CommandOSSXLineBase if (Config->GetModule("operserv")->Get("addakiller", "yes") && !source.GetNick().empty()) reason = "[" + source.GetNick() + "] " + reason; - if (!this->xlm()->CanAdd(source, mask, expires, reason)) - return; - else if (mask.find_first_not_of("/.*?") == Anope::string::npos) + if (mask.find_first_not_of("/.*?") == Anope::string::npos) { source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); return; @@ -380,6 +378,9 @@ class CommandOSSNLine : public CommandOSSXLineBase return; } + if (!this->xlm()->CanAdd(source, mask, expires, reason)) + return; + EventReturn MOD_RESULT; FOREACH_RESULT(OnAddXLine, MOD_RESULT, (source, x, this->xlm())); if (MOD_RESULT == EVENT_STOP) @@ -561,9 +562,7 @@ class CommandOSSQLine : public CommandOSSXLineBase if (Config->GetModule("operserv")->Get("addakiller", "yes") && !source.GetNick().empty()) reason = "[" + source.GetNick() + "] " + reason; - if (!this->sqlines->CanAdd(source, mask, expires, reason)) - return; - else if (mask.find_first_not_of("./?*") == Anope::string::npos) + if (mask.find_first_not_of("./?*") == Anope::string::npos) { source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); return; @@ -587,6 +586,9 @@ class CommandOSSQLine : public CommandOSSXLineBase return; } + if (!this->sqlines->CanAdd(source, mask, expires, reason)) + return; + EventReturn MOD_RESULT; FOREACH_RESULT(OnAddXLine, MOD_RESULT, (source, x, this->xlm())); if (MOD_RESULT == EVENT_STOP) -- cgit