aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-04-30 22:29:38 +0100
committerGravatar Sadie Powell2026-04-30 23:20:14 +0100
commit9bb55626d51f217466bc08104d2f32eb0bf57c02 (patch)
tree44d8c00b97674cd4e35c5a1def208047bf02bcfa /modules
parentMove CommandLine from ServerConfig to InspIRCd. (diff)
Switch ascii comparisons over to our own casemap functions.
Diffstat (limited to 'modules')
-rw-r--r--modules/account.cpp2
-rw-r--r--modules/cloak_custom.cpp2
-rw-r--r--modules/cloak_sha256.cpp2
-rw-r--r--modules/core/core_clients.cpp2
-rw-r--r--modules/core/core_message.cpp4
-rw-r--r--modules/dccallow.cpp2
-rw-r--r--modules/dnsbl.cpp2
-rw-r--r--modules/extra/ldap.cpp10
-rw-r--r--modules/extra/mysql.cpp2
-rw-r--r--modules/extra/pgsql.cpp2
-rw-r--r--modules/extra/sqlite3.cpp2
-rw-r--r--modules/extra/ssl_gnutls.cpp2
-rw-r--r--modules/extra/ssl_openssl.cpp6
-rw-r--r--modules/filter.cpp16
-rw-r--r--modules/gateway.cpp6
-rw-r--r--modules/geoclass.cpp2
-rw-r--r--modules/httpd.cpp2
-rw-r--r--modules/httpd_acl.cpp6
-rw-r--r--modules/httpd_stats.cpp4
-rw-r--r--modules/ircv3_ctctags.cpp2
-rw-r--r--modules/spanningtree/utils.cpp2
-rw-r--r--modules/sslinfo.cpp2
-rw-r--r--modules/websocket.cpp14
23 files changed, 48 insertions, 48 deletions
diff --git a/modules/account.cpp b/modules/account.cpp
index 60b11f4f1..b53463640 100644
--- a/modules/account.cpp
+++ b/modules/account.cpp
@@ -345,7 +345,7 @@ public:
ModResult OnPreChangeConnectClass(LocalUser* user, const std::shared_ptr<ConnectClass>& klass, std::optional<Numeric::Numeric>& errnum) override
{
const char* error = nullptr;
- if (insp::equalsci(klass->config->getString("requireaccount"), "nick"))
+ if (insp::ascii_equals(klass->config->getString("requireaccount"), "nick"))
{
if (!accountapi.GetAccountName(user) && !accountapi.IsIdentifiedToNick(user))
error = "an account matching their current nickname";
diff --git a/modules/cloak_custom.cpp b/modules/cloak_custom.cpp
index 0b4366482..c61590b84 100644
--- a/modules/cloak_custom.cpp
+++ b/modules/cloak_custom.cpp
@@ -90,7 +90,7 @@ public:
, passwordhash(tag->getString("hash", "plaintext", 1))
, cloak(c)
{
- if (insp::equalsci(passwordhash, "plaintext"))
+ if (insp::ascii_equals(passwordhash, "plaintext"))
{
ServerInstance->Logs.Warning(MODNAME, "<customcloak> tag at {} contains an plain text password, this is insecure!",
tag->source.str());
diff --git a/modules/cloak_sha256.cpp b/modules/cloak_sha256.cpp
index 5c807270e..f02d598d3 100644
--- a/modules/cloak_sha256.cpp
+++ b/modules/cloak_sha256.cpp
@@ -325,7 +325,7 @@ public:
if (cloakhost && !psldb.empty())
{
#ifdef HAS_LIBPSL
- if (insp::equalsci(psldb, "system"))
+ if (insp::ascii_equals(psldb, "system"))
{
psldb = psl_dist_filename();
if (psldb.empty())
diff --git a/modules/core/core_clients.cpp b/modules/core/core_clients.cpp
index 6d97e3c69..b6f952bc7 100644
--- a/modules/core/core_clients.cpp
+++ b/modules/core/core_clients.cpp
@@ -207,7 +207,7 @@ public:
ModResult OnAcceptConnection(int nfd, ListenSocket* from, const irc::sockets::sockaddrs& client, const irc::sockets::sockaddrs& server) override
{
- if (!insp::equalsci(from->bind_tag->getString("type", "clients", 1), "clients"))
+ if (!insp::ascii_equals(from->bind_tag->getString("type", "clients", 1), "clients"))
return MOD_RES_PASSTHRU;
ServerInstance->Logs.Debug("USERS", "New user fd: {}", nfd);
diff --git a/modules/core/core_message.cpp b/modules/core/core_message.cpp
index 2baad9a62..a38bf9ecc 100644
--- a/modules/core/core_message.cpp
+++ b/modules/core/core_message.cpp
@@ -221,7 +221,7 @@ private:
{
// The target is a user on a specific server (e.g. jto@tolsun.oulu.fi).
target = ServerInstance->Users.FindNick(parameters[0].substr(0, targetserver - parameters[0].c_str()), true);
- if (target && strcasecmp(target->server->GetPublicName().c_str(), targetserver + 1) != 0)
+ if (target && !insp::ascii_equals(target->server->GetPublicName(), targetserver + 1))
target = nullptr;
}
else
@@ -363,7 +363,7 @@ public:
{
// The target is a user on a specific server (e.g. jto@tolsun.oulu.fi).
target = ServerInstance->Users.FindNick(parameters[0].substr(0, targetserver - parameters[0].c_str()), true);
- if (target && strcasecmp(target->server->GetPublicName().c_str(), targetserver + 1) != 0)
+ if (target && !insp::ascii_equals(target->server->GetPublicName(), targetserver + 1))
target = nullptr;
}
else
diff --git a/modules/dccallow.cpp b/modules/dccallow.cpp
index 02c04559b..8733c322e 100644
--- a/modules/dccallow.cpp
+++ b/modules/dccallow.cpp
@@ -480,7 +480,7 @@ public:
if (InspIRCd::Match(filename, bf.filemask, ascii_case_insensitive_map))
{
/* We have a matching badfile entry, override whatever the default action is */
- if (insp::equalsci(bf.action, "allow"))
+ if (insp::ascii_equals(bf.action, "allow"))
return MOD_RES_PASSTHRU;
else
{
diff --git a/modules/dnsbl.cpp b/modules/dnsbl.cpp
index de6c98853..f7a42b9da 100644
--- a/modules/dnsbl.cpp
+++ b/modules/dnsbl.cpp
@@ -546,7 +546,7 @@ public:
const auto dnsblname = tag->getString("name");
auto dnsbl = std::find_if(newdnsbls.begin(), newdnsbls.end(), [&dnsblname](const auto& d)
{
- return insp::equalsci(d->name, dnsblname);
+ return insp::ascii_equals(d->name, dnsblname);
});
if (dnsbl == newdnsbls.end())
throw ModuleException(weak_from_this(), "<dnsblreply:name> must be set to the name of a DNSBL at " + tag->source.str());
diff --git a/modules/extra/ldap.cpp b/modules/extra/ldap.cpp
index 50cc9022e..26799df2e 100644
--- a/modules/extra/ldap.cpp
+++ b/modules/extra/ldap.cpp
@@ -259,12 +259,12 @@ private:
if (urlComponents.dwSchemeLength > 0)
{
const std::string scheme(urlComponents.lpszScheme);
- if (insp::equalsci(scheme, "ldaps"))
+ if (insp::ascii_equals(scheme, "ldaps"))
{
port = 636; // Default encrypted port.
secure = true;
}
- else if (!insp::equalsci(scheme, "ldap"))
+ else if (!insp::ascii_equals(scheme, "ldap"))
return LDAP_CONNECT_ERROR; // Invalid protocol.
}
@@ -369,9 +369,9 @@ public:
, config(tag)
{
std::string scope = config->getString("searchscope");
- if (insp::equalsci(scope, "base"))
+ if (insp::ascii_equals(scope, "base"))
searchscope = LDAP_SCOPE_BASE;
- else if (insp::equalsci(scope, "onelevel"))
+ else if (insp::ascii_equals(scope, "onelevel"))
searchscope = LDAP_SCOPE_ONELEVEL;
else
searchscope = LDAP_SCOPE_SUBTREE;
@@ -628,7 +628,7 @@ public:
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
{
- if (!insp::equalsci(tag->getString("module"), "ldap"))
+ if (!insp::ascii_equals(tag->getString("module"), "ldap"))
continue;
std::string id = tag->getString("id");
diff --git a/modules/extra/mysql.cpp b/modules/extra/mysql.cpp
index 19b2d4f9b..03da892e3 100644
--- a/modules/extra/mysql.cpp
+++ b/modules/extra/mysql.cpp
@@ -503,7 +503,7 @@ void ModuleSQL::ReadConfig(ConfigStatus& status)
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
{
- if (!insp::equalsci(tag->getString("module"), "mysql"))
+ if (!insp::ascii_equals(tag->getString("module"), "mysql"))
continue;
std::string id = tag->getString("id");
diff --git a/modules/extra/pgsql.cpp b/modules/extra/pgsql.cpp
index d6d85f7e1..3cf1cde18 100644
--- a/modules/extra/pgsql.cpp
+++ b/modules/extra/pgsql.cpp
@@ -612,7 +612,7 @@ public:
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
{
- if (!insp::equalsci(tag->getString("module"), "pgsql"))
+ if (!insp::ascii_equals(tag->getString("module"), "pgsql"))
continue;
std::string id = tag->getString("id");
diff --git a/modules/extra/sqlite3.cpp b/modules/extra/sqlite3.cpp
index 3dab8184d..042e85c49 100644
--- a/modules/extra/sqlite3.cpp
+++ b/modules/extra/sqlite3.cpp
@@ -270,7 +270,7 @@ public:
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
{
- if (!insp::equalsci(tag->getString("module"), "sqlite"))
+ if (!insp::ascii_equals(tag->getString("module"), "sqlite"))
continue;
auto* conn = new SQLConn(weak_from_this(), tag);
diff --git a/modules/extra/ssl_gnutls.cpp b/modules/extra/ssl_gnutls.cpp
index 9aa679d91..1846a10a4 100644
--- a/modules/extra/ssl_gnutls.cpp
+++ b/modules/extra/ssl_gnutls.cpp
@@ -1107,7 +1107,7 @@ class ModuleSSLGnuTLS final
for (const auto& [_, tag] : tags)
{
- if (!insp::equalsci(tag->getString("provider", "gnutls", 1), "gnutls"))
+ if (!insp::ascii_equals(tag->getString("provider", "gnutls", 1), "gnutls"))
{
ServerInstance->Logs.Debug(MODNAME, "Ignoring non-GnuTLS <sslprofile> tag at {}", tag->source.str());
continue;
diff --git a/modules/extra/ssl_openssl.cpp b/modules/extra/ssl_openssl.cpp
index a26d3b127..0682b5cf5 100644
--- a/modules/extra/ssl_openssl.cpp
+++ b/modules/extra/ssl_openssl.cpp
@@ -185,11 +185,11 @@ namespace OpenSSL
/* Set CRL mode */
unsigned long crlflags = X509_V_FLAG_CRL_CHECK;
- if (insp::equalsci(crlmode, "chain"))
+ if (insp::ascii_equals(crlmode, "chain"))
{
crlflags |= X509_V_FLAG_CRL_CHECK_ALL;
}
- else if (!insp::equalsci(crlmode, "leaf"))
+ else if (!insp::ascii_equals(crlmode, "leaf"))
{
throw ModuleException(thismod, "Unknown mode '" + crlmode + "'; expected either 'chain' (default) or 'leaf'");
}
@@ -986,7 +986,7 @@ class ModuleSSLOpenSSL final
for (const auto& [_, tag] : tags)
{
- if (!insp::equalsci(tag->getString("provider", "openssl", 1), "openssl"))
+ if (!insp::ascii_equals(tag->getString("provider", "openssl", 1), "openssl"))
{
ServerInstance->Logs.Debug(MODNAME, "Ignoring non-OpenSSL <sslprofile> tag at {}", tag->source.str());
continue;
diff --git a/modules/filter.cpp b/modules/filter.cpp
index fe84a6002..d104dabfb 100644
--- a/modules/filter.cpp
+++ b/modules/filter.cpp
@@ -841,21 +841,21 @@ std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string& freeform
bool ModuleFilter::StringToFilterAction(const std::string& str, FilterAction& fa)
{
- if (insp::equalsci(str, "gline"))
+ if (insp::ascii_equals(str, "gline"))
fa = FA_GLINE;
- else if (insp::equalsci(str, "zline"))
+ else if (insp::ascii_equals(str, "zline"))
fa = FA_ZLINE;
- else if (insp::equalsci(str, "warn"))
+ else if (insp::ascii_equals(str, "warn"))
fa = FA_WARN;
- else if (insp::equalsci(str, "block"))
+ else if (insp::ascii_equals(str, "block"))
fa = FA_BLOCK;
- else if (insp::equalsci(str, "silent"))
+ else if (insp::ascii_equals(str, "silent"))
fa = FA_SILENT;
- else if (insp::equalsci(str, "kill"))
+ else if (insp::ascii_equals(str, "kill"))
fa = FA_KILL;
- else if (insp::equalsci(str, "shun") && (ServerInstance->XLines->GetFactory("SHUN")))
+ else if (insp::ascii_equals(str, "shun") && (ServerInstance->XLines->GetFactory("SHUN")))
fa = FA_SHUN;
- else if (insp::equalsci(str, "none"))
+ else if (insp::ascii_equals(str, "none"))
fa = FA_NONE;
else
return false;
diff --git a/modules/gateway.cpp b/modules/gateway.cpp
index 7118a6dd5..f1715f413 100644
--- a/modules/gateway.cpp
+++ b/modules/gateway.cpp
@@ -392,13 +392,13 @@ public:
// Determine what lookup type this host uses.
const std::string type = tag->getString("type");
- if (insp::equalsci(type, "username") || insp::equalsci(type, "ident"))
+ if (insp::ascii_equals(type, "username") || insp::ascii_equals(type, "ident"))
{
// The IP address should be looked up from the hex IP address.
const std::string newuser = tag->getString("newusername", "gateway", ServerInstance->Users.IsUser);
userhosts.emplace_back(masks, newuser);
}
- else if (insp::equalsci(type, "webirc"))
+ else if (insp::ascii_equals(type, "webirc"))
{
// The IP address will be received via the WEBIRC command.
const std::string fingerprint = tag->getString("fingerprint");
@@ -410,7 +410,7 @@ public:
if (fingerprint.empty() && password.empty())
throw ModuleException(weak_from_this(), "When using <" + tag->name + " type=\"webirc\"> either the fingerprint or password field is required, at " + tag->source.str());
- if (!password.empty() && insp::equalsci(passwordhash, "plaintext"))
+ if (!password.empty() && insp::ascii_equals(passwordhash, "plaintext"))
{
ServerInstance->Logs.Normal(MODNAME, "<{}> tag at {} contains an plain text password, this is insecure!",
tag->name, tag->source.str());
diff --git a/modules/geoclass.cpp b/modules/geoclass.cpp
index 817e8291b..3549c3dc3 100644
--- a/modules/geoclass.cpp
+++ b/modules/geoclass.cpp
@@ -61,7 +61,7 @@ public:
// If the user matches this country code then they can use this
// connect class.
- if (insp::equalsci(token, code))
+ if (insp::ascii_equals(token, code))
return MOD_RES_PASSTHRU;
}
diff --git a/modules/httpd.cpp b/modules/httpd.cpp
index ff1a842c0..227cbf4f6 100644
--- a/modules/httpd.cpp
+++ b/modules/httpd.cpp
@@ -451,7 +451,7 @@ public:
ModResult OnAcceptConnection(int nfd, ListenSocket* from, const irc::sockets::sockaddrs& client, const irc::sockets::sockaddrs& server) override
{
- if (!insp::equalsci(from->bind_tag->getString("type"), "httpd"))
+ if (!insp::ascii_equals(from->bind_tag->getString("type"), "httpd"))
return MOD_RES_PASSTHRU;
sockets.push_front(new HttpServerSocket(nfd, client.addr(), from, client, server, timeoutsec));
diff --git a/modules/httpd_acl.cpp b/modules/httpd_acl.cpp
index 083fe0b4d..65ced0c44 100644
--- a/modules/httpd_acl.cpp
+++ b/modules/httpd_acl.cpp
@@ -79,16 +79,16 @@ public:
while (sep.GetToken(type))
{
- if (insp::equalsci(type, "password"))
+ if (insp::ascii_equals(type, "password"))
{
username = c->getString("username");
password = c->getString("password");
}
- else if (insp::equalsci(type, "whitelist"))
+ else if (insp::ascii_equals(type, "whitelist"))
{
whitelist = c->getString("whitelist");
}
- else if (insp::equalsci(type, "blacklist"))
+ else if (insp::ascii_equals(type, "blacklist"))
{
blacklist = c->getString("blacklist");
}
diff --git a/modules/httpd_stats.cpp b/modules/httpd_stats.cpp
index 2e82970c4..4a5cec3bd 100644
--- a/modules/httpd_stats.cpp
+++ b/modules/httpd_stats.cpp
@@ -402,9 +402,9 @@ namespace Stats
bool desc = params.getBool("desc", false);
OrderBy orderby;
- if (insp::equalsci(sortmethod, "nick"))
+ if (insp::ascii_equals(sortmethod, "nick"))
orderby = OB_NICK;
- else if (insp::equalsci(sortmethod, "lastmsg"))
+ else if (insp::ascii_equals(sortmethod, "lastmsg"))
{
orderby = OB_LASTMSG;
// We can only check idle times on local users
diff --git a/modules/ircv3_ctctags.cpp b/modules/ircv3_ctctags.cpp
index bf3e45d0f..711cb0166 100644
--- a/modules/ircv3_ctctags.cpp
+++ b/modules/ircv3_ctctags.cpp
@@ -171,7 +171,7 @@ private:
{
// The target is a user on a specific server (e.g. jto@tolsun.oulu.fi).
target = ServerInstance->Users.FindNick(parameters[0].substr(0, targetserver - parameters[0].c_str()), true);
- if (target && strcasecmp(target->server->GetPublicName().c_str(), targetserver + 1) != 0)
+ if (target && !insp::ascii_equals(target->server->GetPublicName(), targetserver + 1))
target = nullptr;
}
else
diff --git a/modules/spanningtree/utils.cpp b/modules/spanningtree/utils.cpp
index f430da9a8..9f0542ca0 100644
--- a/modules/spanningtree/utils.cpp
+++ b/modules/spanningtree/utils.cpp
@@ -41,7 +41,7 @@ SpanningTreeUtilities* Utils = nullptr;
ModResult ModuleSpanningTree::OnAcceptConnection(int newsock, ListenSocket* from, const irc::sockets::sockaddrs& client, const irc::sockets::sockaddrs& server)
{
- if (!insp::equalsci(from->bind_tag->getString("type"), "servers"))
+ if (!insp::ascii_equals(from->bind_tag->getString("type"), "servers"))
return MOD_RES_PASSTHRU;
const std::string incomingip = client.addr();
diff --git a/modules/sslinfo.cpp b/modules/sslinfo.cpp
index a064ff109..3a2a0bcf0 100644
--- a/modules/sslinfo.cpp
+++ b/modules/sslinfo.cpp
@@ -564,7 +564,7 @@ public:
const auto* cert = cmd.tlsapi.GetCertificate(user);
const char* error = nullptr;
const std::string requiressl = klass->config->getString("requiressl");
- if (insp::equalsci(requiressl, "trusted"))
+ if (insp::ascii_equals(requiressl, "trusted"))
{
if (!cert || !cert->IsUsable(true))
error = "a trusted TLS client certificate";
diff --git a/modules/websocket.cpp b/modules/websocket.cpp
index caff2e93a..301867d49 100644
--- a/modules/websocket.cpp
+++ b/modules/websocket.cpp
@@ -516,11 +516,11 @@ class WebSocketHook final
{
std::erase_if(proto, ::isspace);
- auto is_binary = (sock->type == StreamSocket::SS_USER && insp::equalsci(proto, "binary.ircv3.net"))
- || insp::equalsci(proto, "binary.inspircd.org");
+ auto is_binary = (sock->type == StreamSocket::SS_USER && insp::ascii_equals(proto, "binary.ircv3.net"))
+ || insp::ascii_equals(proto, "binary.inspircd.org");
- auto is_text = (sock->type == StreamSocket::SS_USER && insp::equalsci(proto, "text.ircv3.net"))
- || insp::equalsci(proto, "text.inspircd.org");
+ auto is_text = (sock->type == StreamSocket::SS_USER && insp::ascii_equals(proto, "text.ircv3.net"))
+ || insp::ascii_equals(proto, "text.inspircd.org");
if (is_binary || is_text)
{
@@ -729,11 +729,11 @@ public:
const auto& tag = ServerInstance->Config->ConfValue("websocket");
const std::string defaultmodestr = tag->getString("defaultmode", config.allowtext ? "text" : "binary", 1);
- if (insp::equalsci(defaultmodestr, "reject"))
+ if (insp::ascii_equals(defaultmodestr, "reject"))
config.defaultmode = WebSocketConfig::DM_REJECT;
- else if (insp::equalsci(defaultmodestr, "binary"))
+ else if (insp::ascii_equals(defaultmodestr, "binary"))
config.defaultmode = WebSocketConfig::DM_BINARY;
- else if (insp::equalsci(defaultmodestr, "text"))
+ else if (insp::ascii_equals(defaultmodestr, "text"))
config.defaultmode = WebSocketConfig::DM_TEXT;
else
throw ModuleException(weak_from_this(), defaultmodestr + " is an invalid value for <websocket:defaultmode>; acceptable values are 'binary', 'text' and 'reject', at " + tag->source.str());