aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-04-16 12:13:11 +0100
committerGravatar Sadie Powell2025-04-16 12:13:11 +0100
commita3e736de1d3b6423e88b58506c0bfbe89dec3bd3 (patch)
tree04ffa9b7f162c00c5ce4f5da11344ff02622660a /modules
parentRefuse to hash passwords using insecure algorithms in MKPASSWD. (diff)
Add <security:banrealmask>.
Diffstat (limited to 'modules')
-rw-r--r--modules/account.cpp6
-rw-r--r--modules/banexception.cpp8
-rw-r--r--modules/banredirect.cpp2
-rw-r--r--modules/channelban.cpp2
-rw-r--r--modules/classban.cpp2
-rw-r--r--modules/cloak.cpp13
-rw-r--r--modules/core/core_channel/core_channel.cpp6
-rw-r--r--modules/core/core_channel/core_channel.h2
-rw-r--r--modules/core/core_channel/extban.cpp8
-rw-r--r--modules/gateway.cpp2
-rw-r--r--modules/geoban.cpp2
-rw-r--r--modules/operchans.cpp4
-rw-r--r--modules/realnameban.cpp4
-rw-r--r--modules/serverban.cpp2
-rw-r--r--modules/sslmodes.cpp2
15 files changed, 35 insertions, 30 deletions
diff --git a/modules/account.cpp b/modules/account.cpp
index 205a5e392..412859019 100644
--- a/modules/account.cpp
+++ b/modules/account.cpp
@@ -139,7 +139,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
const auto* nicks = accountapi.GetAccountNicks(user);
if (nicks)
@@ -169,10 +169,10 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
const std::string* account = accountapi.GetAccountName(user);
- return !account && channel->CheckBan(user, text);
+ return !account && channel->CheckBan(user, text, full);
}
};
diff --git a/modules/banexception.cpp b/modules/banexception.cpp
index 3c743b5d9..c606ac440 100644
--- a/modules/banexception.cpp
+++ b/modules/banexception.cpp
@@ -91,7 +91,7 @@ public:
tokens["EXCEPTS"] = ConvToStr(be.GetModeChar());
}
- ModResult OnExtBanCheck(User* user, Channel* chan, ExtBan::Base* extban) override
+ ModResult OnExtBanCheck(User* user, Channel* chan, ExtBan::Base* extban, bool full) override
{
ListModeBase::ModeList* list = be.GetList(chan);
if (!list)
@@ -118,12 +118,12 @@ public:
continue;
}
- return extban->IsMatch(user, chan, value) != inverted ? MOD_RES_ALLOW : MOD_RES_PASSTHRU;
+ return extban->IsMatch(user, chan, value, full) != inverted ? MOD_RES_ALLOW : MOD_RES_PASSTHRU;
}
return MOD_RES_PASSTHRU;
}
- ModResult OnCheckChannelBan(User* user, Channel* chan) override
+ ModResult OnCheckChannelBan(User* user, Channel* chan, bool full) override
{
ListModeBase::ModeList* list = be.GetList(chan);
if (!list)
@@ -134,7 +134,7 @@ public:
for (const auto& entry : *list)
{
- if (chan->CheckBan(user, entry.mask))
+ if (chan->CheckBan(user, entry.mask, full))
{
// They match an entry on the list, so let them in.
return MOD_RES_ALLOW;
diff --git a/modules/banredirect.cpp b/modules/banredirect.cpp
index c6c4b925a..53bff3a99 100644
--- a/modules/banredirect.cpp
+++ b/modules/banredirect.cpp
@@ -304,7 +304,7 @@ public:
{
/* We actually had some ban redirects to check */
ModResult result;
- FIRST_MOD_RESULT(OnCheckChannelBan, result, (user, chan));
+ FIRST_MOD_RESULT(OnCheckChannelBan, result, (user, chan, ServerInstance->Config->BanRealMask));
if (result == MOD_RES_ALLOW)
{
// they have a ban exception
diff --git a/modules/channelban.cpp b/modules/channelban.cpp
index 48b06032b..58d6701f9 100644
--- a/modules/channelban.cpp
+++ b/modules/channelban.cpp
@@ -33,7 +33,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
unsigned char status = 0;
const char* target = text.c_str();
diff --git a/modules/classban.cpp b/modules/classban.cpp
index 636ceb9c8..04eaaf2ca 100644
--- a/modules/classban.cpp
+++ b/modules/classban.cpp
@@ -30,7 +30,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
LocalUser* luser = IS_LOCAL(user);
if (!luser)
diff --git a/modules/cloak.cpp b/modules/cloak.cpp
index de39be736..d7e9bb341 100644
--- a/modules/cloak.cpp
+++ b/modules/cloak.cpp
@@ -484,7 +484,7 @@ public:
}
}
- ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask) override
+ ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask, bool full) override
{
LocalUser* lu = IS_LOCAL(user);
if (!lu)
@@ -503,11 +503,14 @@ public:
const auto &ruser = cloak.username.empty() ? user->GetRealUser() : cloak.username;
const auto &duser = cloak.username.empty() ? user->GetDisplayedUser() : cloak.username;
- std::string cloakmask = FMT::format("{}!{}@{}", user->nick, ruser, cloak.hostname);
- if (InspIRCd::Match(cloakmask, mask))
- return MOD_RES_DENY;
+ if (full)
+ {
+ auto cloakmask = FMT::format("{}!{}@{}", user->nick, ruser, cloak.hostname);
+ if (InspIRCd::Match(cloakmask, mask))
+ return MOD_RES_DENY;
+ }
- cloakmask = FMT::format("{}!{}@{}", user->nick, duser, cloak.hostname);
+ auto cloakmask = FMT::format("{}!{}@{}", user->nick, duser, cloak.hostname);
if (InspIRCd::Match(cloakmask, mask))
return MOD_RES_DENY;
}
diff --git a/modules/core/core_channel/core_channel.cpp b/modules/core/core_channel/core_channel.cpp
index 238849a87..40b6916a3 100644
--- a/modules/core/core_channel/core_channel.cpp
+++ b/modules/core/core_channel/core_channel.cpp
@@ -343,7 +343,7 @@ public:
return IsInvited(user, chan);
}
- ModResult OnCheckChannelBan(User* user, Channel* chan) override
+ ModResult OnCheckChannelBan(User* user, Channel* chan, bool full) override
{
// Hook only runs when being invited bypasses +bkl
return IsInvited(user, chan);
@@ -372,7 +372,7 @@ public:
invapi.RemoveAll(chan);
}
- ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask) override
+ ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask, bool full) override
{
bool inverted;
std::string name;
@@ -390,7 +390,7 @@ public:
if (!extban || extban->GetType() != ExtBan::Type::MATCHING)
return MOD_RES_PASSTHRU;
- return extban->IsMatch(user, chan, value) != inverted ? MOD_RES_DENY : MOD_RES_PASSTHRU;
+ return extban->IsMatch(user, chan, value, full) != inverted ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
ModResult OnCheckExemption(User* user, Channel* chan, const std::string& restriction) override
diff --git a/modules/core/core_channel/core_channel.h b/modules/core/core_channel/core_channel.h
index 1e97bf1ad..bb6db115c 100644
--- a/modules/core/core_channel/core_channel.h
+++ b/modules/core/core_channel/core_channel.h
@@ -172,7 +172,7 @@ public:
ExtBan::Format GetFormat() const override { return format; }
const LetterMap& GetLetterMap() const override { return byletter; }
const NameMap& GetNameMap() const override { return byname; }
- ModResult GetStatus(ExtBan::ActingBase* extban, User* user, Channel* channel) const override;
+ ModResult GetStatus(ExtBan::ActingBase* extban, User* user, Channel* channel, const std::optional<bool>& full) const override;
ExtBan::Base* FindName(const std::string& name) const override;
ExtBan::Base* FindLetter(ExtBan::Letter letter) const override;
void BuildISupport(std::string& out);
diff --git a/modules/core/core_channel/extban.cpp b/modules/core/core_channel/extban.cpp
index de19d4b54..5df402565 100644
--- a/modules/core/core_channel/extban.cpp
+++ b/modules/core/core_channel/extban.cpp
@@ -123,9 +123,11 @@ void ExtBanManager::BuildISupport(std::string& out)
out.insert(0, ",");
}
-ModResult ExtBanManager::GetStatus(ExtBan::ActingBase* extban, User* user, Channel* channel) const
+ModResult ExtBanManager::GetStatus(ExtBan::ActingBase* extban, User* user, Channel* channel, const std::optional<bool>& ofull) const
{
- ModResult res = evprov.FirstResult(&ExtBan::EventListener::OnExtBanCheck, user, channel, extban);
+ auto full = ofull.value_or(ServerInstance->Config->BanRealMask);
+
+ ModResult res = evprov.FirstResult(&ExtBan::EventListener::OnExtBanCheck, user, channel, extban, full);
if (res != MOD_RES_PASSTHRU)
return res;
@@ -156,7 +158,7 @@ ModResult ExtBanManager::GetStatus(ExtBan::ActingBase* extban, User* user, Chann
// For a non-inverted (regular) extban we want to match but for an
// inverted extban we want to not match.
- if (extban->IsMatch(user, channel, xbvalue) != inverted)
+ if (extban->IsMatch(user, channel, xbvalue, full) != inverted)
return MOD_RES_DENY;
}
return MOD_RES_PASSTHRU;
diff --git a/modules/gateway.cpp b/modules/gateway.cpp
index a71f60560..f36a9a11d 100644
--- a/modules/gateway.cpp
+++ b/modules/gateway.cpp
@@ -234,7 +234,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
const std::string* gatewayname = gateway.Get(user);
return gatewayname ? InspIRCd::Match(*gatewayname, text) : false;
diff --git a/modules/geoban.cpp b/modules/geoban.cpp
index 5e6ecbb41..b2df12ed4 100644
--- a/modules/geoban.cpp
+++ b/modules/geoban.cpp
@@ -37,7 +37,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
Geolocation::Location* location = geoapi ? geoapi->GetLocation(user) : nullptr;
const std::string code = location ? location->GetCode() : "XX";
diff --git a/modules/operchans.cpp b/modules/operchans.cpp
index f5c046d68..195770b7a 100644
--- a/modules/operchans.cpp
+++ b/modules/operchans.cpp
@@ -40,7 +40,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
// If the user is not an oper they can't match this.
if (!user->IsOper())
@@ -62,7 +62,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
// If the user is not an oper they can't match this.
if (!user->IsOper())
diff --git a/modules/realnameban.cpp b/modules/realnameban.cpp
index 00c860a1b..0bb04f7a6 100644
--- a/modules/realnameban.cpp
+++ b/modules/realnameban.cpp
@@ -34,7 +34,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
// Check that the user actually specified a real name.
const size_t divider = text.find('+', 1);
@@ -59,7 +59,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
return InspIRCd::Match(user->GetRealName(), text);
}
diff --git a/modules/serverban.cpp b/modules/serverban.cpp
index 2fb25bd14..c5e4a2c27 100644
--- a/modules/serverban.cpp
+++ b/modules/serverban.cpp
@@ -33,7 +33,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
return InspIRCd::Match(user->server->GetPublicName(), text);
}
diff --git a/modules/sslmodes.cpp b/modules/sslmodes.cpp
index 213115bcc..68e7ffc62 100644
--- a/modules/sslmodes.cpp
+++ b/modules/sslmodes.cpp
@@ -54,7 +54,7 @@ public:
{
}
- bool IsMatch(User* user, Channel* channel, const std::string& text) override
+ bool IsMatch(User* user, Channel* channel, const std::string& text, bool full) override
{
if (!sslapi)
return false;