aboutsummaryrefslogtreecommitdiff
path: root/src/coremods
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-12-10 12:11:57 +0000
committerGravatar Sadie Powell2022-12-10 12:27:06 +0000
commit4eff31cc82d1eabb4849a630fcc6d3034d73819f (patch)
tree3fa7d13c7055b18d010271437700f21589c24284 /src/coremods
parentAllow specifying multiple masks when adding an X-line. (diff)
Tell an oper when the X-line they were trying to match is too wide.
Also move the snotice for an overwide X-line to snomask 'X' which should have been done when it was added.
Diffstat (limited to 'src/coremods')
-rw-r--r--src/coremods/core_xline/cmd_eline.cpp2
-rw-r--r--src/coremods/core_xline/cmd_gline.cpp2
-rw-r--r--src/coremods/core_xline/cmd_kline.cpp2
-rw-r--r--src/coremods/core_xline/cmd_qline.cpp2
-rw-r--r--src/coremods/core_xline/cmd_zline.cpp2
-rw-r--r--src/coremods/core_xline/core_xline.cpp8
-rw-r--r--src/coremods/core_xline/core_xline.h2
7 files changed, 12 insertions, 8 deletions
diff --git a/src/coremods/core_xline/cmd_eline.cpp b/src/coremods/core_xline/cmd_eline.cpp
index 8002d04a0..e7f0e88c1 100644
--- a/src/coremods/core_xline/cmd_eline.cpp
+++ b/src/coremods/core_xline/cmd_eline.cpp
@@ -64,7 +64,7 @@ CmdResult CommandEline::Handle(User* user, const Params& parameters)
}
InsaneBan::IPHostMatcher matcher;
- if (InsaneBan::MatchesEveryone(ih.first+"@"+ih.second, matcher, user, "E", "hostmasks"))
+ if (InsaneBan::MatchesEveryone(ih.first + "@" + ih.second, matcher, user, 'E', "hostmasks"))
return CMD_FAILURE;
unsigned long duration;
diff --git a/src/coremods/core_xline/cmd_gline.cpp b/src/coremods/core_xline/cmd_gline.cpp
index 8f9c418b1..7a6441a0e 100644
--- a/src/coremods/core_xline/cmd_gline.cpp
+++ b/src/coremods/core_xline/cmd_gline.cpp
@@ -65,7 +65,7 @@ CmdResult CommandGline::Handle(User* user, const Params& parameters)
}
InsaneBan::IPHostMatcher matcher;
- if (InsaneBan::MatchesEveryone(ih.first+"@"+ih.second, matcher, user, "G", "hostmasks"))
+ if (InsaneBan::MatchesEveryone(ih.first + "@" + ih.second, matcher, user, 'G', "hostmasks"))
return CMD_FAILURE;
else if (target.find('!') != std::string::npos)
diff --git a/src/coremods/core_xline/cmd_kline.cpp b/src/coremods/core_xline/cmd_kline.cpp
index 99498018e..f791a5be8 100644
--- a/src/coremods/core_xline/cmd_kline.cpp
+++ b/src/coremods/core_xline/cmd_kline.cpp
@@ -65,7 +65,7 @@ CmdResult CommandKline::Handle(User* user, const Params& parameters)
}
InsaneBan::IPHostMatcher matcher;
- if (InsaneBan::MatchesEveryone(ih.first+"@"+ih.second, matcher, user, "K", "hostmasks"))
+ if (InsaneBan::MatchesEveryone(ih.first + "@" + ih.second, matcher, user, 'K', "hostmasks"))
return CMD_FAILURE;
if (target.find('!') != std::string::npos)
diff --git a/src/coremods/core_xline/cmd_qline.cpp b/src/coremods/core_xline/cmd_qline.cpp
index b6fd91a21..517577fab 100644
--- a/src/coremods/core_xline/cmd_qline.cpp
+++ b/src/coremods/core_xline/cmd_qline.cpp
@@ -46,7 +46,7 @@ CmdResult CommandQline::Handle(User* user, const Params& parameters)
if (parameters.size() >= 3)
{
NickMatcher matcher;
- if (InsaneBan::MatchesEveryone(parameters[0], matcher, user, "Q", "nickmasks"))
+ if (InsaneBan::MatchesEveryone(parameters[0], matcher, user, 'Q', "nickmasks"))
return CMD_FAILURE;
if (parameters[0].find('@') != std::string::npos || parameters[0].find('!') != std::string::npos || parameters[0].find('.') != std::string::npos)
diff --git a/src/coremods/core_xline/cmd_zline.cpp b/src/coremods/core_xline/cmd_zline.cpp
index 3b852b0d5..046da53dc 100644
--- a/src/coremods/core_xline/cmd_zline.cpp
+++ b/src/coremods/core_xline/cmd_zline.cpp
@@ -69,7 +69,7 @@ CmdResult CommandZline::Handle(User* user, const Params& parameters)
}
IPMatcher matcher;
- if (InsaneBan::MatchesEveryone(ipaddr, matcher, user, "Z", "ipmasks"))
+ if (InsaneBan::MatchesEveryone(ipaddr, matcher, user, 'Z', "ipmasks"))
return CMD_FAILURE;
unsigned long duration;
diff --git a/src/coremods/core_xline/core_xline.cpp b/src/coremods/core_xline/core_xline.cpp
index f23cbe143..2289c4aaf 100644
--- a/src/coremods/core_xline/core_xline.cpp
+++ b/src/coremods/core_xline/core_xline.cpp
@@ -25,7 +25,7 @@
#include "xline.h"
#include "core_xline.h"
-bool InsaneBan::MatchesEveryone(const std::string& mask, MatcherBase& test, User* user, const char* bantype, const char* confkey)
+bool InsaneBan::MatchesEveryone(const std::string& mask, MatcherBase& test, User* user, char bantype, const char* confkey)
{
ConfigTag* insane = ServerInstance->Config->ConfValue("insane");
@@ -42,7 +42,11 @@ bool InsaneBan::MatchesEveryone(const std::string& mask, MatcherBase& test, User
float percent = ((float)matches / (float)ServerInstance->Users->GetUsers().size()) * 100;
if (percent > itrigger)
{
- ServerInstance->SNO->WriteToSnoMask('a', "\002WARNING\002: %s tried to set a %s-line mask of %s, which covers %.2f%% of the network!", user->nick.c_str(), bantype, mask.c_str(), percent);
+ const char* article = strchr("AEIOUaeiou", bantype) ? "an" : "a";
+ ServerInstance->SNO->WriteToSnoMask('x', "\002WARNING\002: %s tried to set add %s %c-line on %s which covers %.2f%% of the network which is more than the maximum of %.2f%%!",
+ user->nick.c_str(), article, bantype, mask.c_str(), percent, itrigger);
+ user->WriteNotice(InspIRCd::Format("*** Unable to add %s %c-line on %s which covers %.2f%% of the network which is more than the maximum of %.2f%%!",
+ article, bantype, mask.c_str(), percent, itrigger));
return true;
}
return false;
diff --git a/src/coremods/core_xline/core_xline.h b/src/coremods/core_xline/core_xline.h
index 4384623f1..a6d6de605 100644
--- a/src/coremods/core_xline/core_xline.h
+++ b/src/coremods/core_xline/core_xline.h
@@ -65,7 +65,7 @@ class InsaneBan
* @param confkey Name of the config key (inside the insane tag) which if false disables any checking
* @return True if the given mask matches too many users, false if not
*/
- static bool MatchesEveryone(const std::string& mask, MatcherBase& test, User* user, const char* bantype, const char* confkey);
+ static bool MatchesEveryone(const std::string& mask, MatcherBase& test, User* user, char bantype, const char* confkey);
};
/** Handle /ELINE.