From 681b488fc0ebca964eddf2a54575dc41901bc520 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 5 Aug 2023 12:02:14 +0100 Subject: Update usages of stdalgo::string::equalsci to use insp::equalsci. --- src/configparser.cpp | 15 ++++++++------- src/configreader.cpp | 18 +++++++++--------- src/coremods/core_clients.cpp | 3 ++- src/helperfuncs.cpp | 3 ++- src/listmode.cpp | 2 +- src/modules/extra/m_ldap.cpp | 13 +++++++------ src/modules/extra/m_mysql.cpp | 3 ++- src/modules/extra/m_pgsql.cpp | 3 ++- src/modules/extra/m_sqlite3.cpp | 3 ++- src/modules/extra/m_ssl_gnutls.cpp | 3 ++- src/modules/extra/m_ssl_mbedtls.cpp | 3 ++- src/modules/extra/m_ssl_openssl.cpp | 7 ++++--- src/modules/m_account.cpp | 2 +- src/modules/m_cloak_sha256.cpp | 3 ++- src/modules/m_customtitle.cpp | 2 +- src/modules/m_dccallow.cpp | 2 +- src/modules/m_dnsbl.cpp | 4 ++-- src/modules/m_filter.cpp | 17 +++++++++-------- src/modules/m_gateway.cpp | 6 +++--- src/modules/m_geoclass.cpp | 3 ++- src/modules/m_httpd.cpp | 2 +- src/modules/m_httpd_acl.cpp | 7 ++++--- src/modules/m_httpd_stats.cpp | 4 ++-- src/modules/m_spanningtree/capab.cpp | 10 +++++----- src/modules/m_spanningtree/utils.cpp | 2 +- src/modules/m_sslinfo.cpp | 2 +- src/modules/m_vhost.cpp | 3 ++- src/modules/m_websocket.cpp | 11 ++++++----- src/socket.cpp | 7 ++++--- src/users.cpp | 14 +++++++------- 30 files changed, 97 insertions(+), 80 deletions(-) (limited to 'src') diff --git a/src/configparser.cpp b/src/configparser.cpp index bc554e7bb..8a491c6b2 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -29,6 +29,7 @@ #include "inspircd.h" #include "configparser.h" #include "timeutils.h" +#include "utility/string.h" #ifdef _WIN32 # define pclose _pclose @@ -261,21 +262,21 @@ struct Parser final mandatory_tag.clear(); } - if (stdalgo::string::equalsci(name, "include")) + if (insp::equalsci(name, "include")) { stack.DoInclude(tag, flags); } - else if (stdalgo::string::equalsci(name, "files")) + else if (insp::equalsci(name, "files")) { for (const auto& [key, value] : tag->GetItems()) stack.DoReadFile(key, value, flags, false); } - else if (stdalgo::string::equalsci(name, "execfiles")) + else if (insp::equalsci(name, "execfiles")) { for (const auto& [key, value] : tag->GetItems()) stack.DoReadFile(key, value, flags, true); } - else if (stdalgo::string::equalsci(name, "define")) + else if (insp::equalsci(name, "define")) { const std::string varname = tag->getString("name"); if (varname.empty()) @@ -541,7 +542,7 @@ bool ConfigTag::readString(const std::string& key, std::string& value, bool allo { for (const auto& [ikey, ivalue] : items) { - if (!stdalgo::string::equalsci(ikey, key)) + if (!insp::equalsci(ikey, key)) continue; value = ivalue; @@ -717,10 +718,10 @@ bool ConfigTag::getBool(const std::string& key, bool def) const if(!readString(key, result) || result.empty()) return def; - if (stdalgo::string::equalsci(result, "yes") || stdalgo::string::equalsci(result, "true") || stdalgo::string::equalsci(result, "on")) + if (insp::equalsci(result, "yes") || insp::equalsci(result, "true") || insp::equalsci(result, "on")) return true; - if (stdalgo::string::equalsci(result, "no") || stdalgo::string::equalsci(result, "false") || stdalgo::string::equalsci(result, "off")) + if (insp::equalsci(result, "no") || insp::equalsci(result, "false") || insp::equalsci(result, "off")) return false; LogMalformed(key, result, def ? "yes" : "no", "is not a boolean"); diff --git a/src/configreader.cpp b/src/configreader.cpp index 041c573fd..1fb12dc0d 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -668,32 +668,32 @@ std::vector ServerConfig::GetModules() const } // Rewrite the old names of renamed modules. - if (stdalgo::string::equalsci(shortname, "cgiirc")) + if (insp::equalsci(shortname, "cgiirc")) modules.push_back("gateway"); - else if (stdalgo::string::equalsci(shortname, "cloaking")) + else if (insp::equalsci(shortname, "cloaking")) { modules.push_back("cloak"); modules.push_back("cloak_md5"); } - else if (stdalgo::string::equalsci(shortname, "gecosban")) + else if (insp::equalsci(shortname, "gecosban")) modules.push_back("realnameban"); - else if (stdalgo::string::equalsci(shortname, "helpop")) + else if (insp::equalsci(shortname, "helpop")) { modules.push_back("help"); modules.push_back("helpmode"); } - else if (stdalgo::string::equalsci(shortname, "regex_pcre2")) + else if (insp::equalsci(shortname, "regex_pcre2")) modules.push_back("regex_pcre"); - else if (stdalgo::string::equalsci(shortname, "sha256")) + else if (insp::equalsci(shortname, "sha256")) modules.push_back("sha2"); - else if (stdalgo::string::equalsci(shortname, "services_account")) + else if (insp::equalsci(shortname, "services_account")) { modules.push_back("account"); modules.push_back("services"); } - else if (stdalgo::string::equalsci(shortname, "servprotect")) + else if (insp::equalsci(shortname, "servprotect")) modules.push_back("services"); - else if (stdalgo::string::equalsci(shortname, "svshold")) + else if (insp::equalsci(shortname, "svshold")) modules.push_back("services"); else { diff --git a/src/coremods/core_clients.cpp b/src/coremods/core_clients.cpp index b11600c2e..d29f886a6 100644 --- a/src/coremods/core_clients.cpp +++ b/src/coremods/core_clients.cpp @@ -18,6 +18,7 @@ #include "inspircd.h" +#include "utility/string.h" class CoreModClients final : public Module @@ -32,7 +33,7 @@ public: ModResult OnAcceptConnection(int nfd, ListenSocket* from, const irc::sockets::sockaddrs& client, const irc::sockets::sockaddrs& server) override { - if (!stdalgo::string::equalsci(from->bind_tag->getString("type", "clients", 1), "clients")) + if (!insp::equalsci(from->bind_tag->getString("type", "clients", 1), "clients")) return MOD_RES_PASSTHRU; ServerInstance->Users.AddUser(nfd, from, client, server); diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 4da2a4d3d..81c8dacc4 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -32,6 +32,7 @@ #include "inspircd.h" #include "timeutils.h" +#include "utility/string.h" #include "xline.h" bool InspIRCd::CheckPassword(const std::string& password, const std::string& passwordhash, const std::string& value) @@ -47,7 +48,7 @@ bool InspIRCd::CheckPassword(const std::string& password, const std::string& pas // The hash algorithm wasn't recognised by any modules. If its plain // text then we can check it internally. - if (passwordhash.empty() || stdalgo::string::equalsci(passwordhash, "plaintext")) + if (passwordhash.empty() || insp::equalsci(passwordhash, "plaintext")) return TimingSafeCompare(password, value); // The password was invalid. diff --git a/src/listmode.cpp b/src/listmode.cpp index 8b3cdfdeb..f70409a5e 100644 --- a/src/listmode.cpp +++ b/src/listmode.cpp @@ -77,7 +77,7 @@ void ListModeBase::DoRehash() for (const auto& [_, c] : ServerInstance->Config->ConfTags("maxlist")) { const std::string mname = c->getString("mode"); - if (!mname.empty() && !stdalgo::string::equalsci(mname, name) && !(mname.length() == 1 && GetModeChar() == mname[0])) + if (!mname.empty() && !insp::equalsci(mname, name) && !(mname.length() == 1 && GetModeChar() == mname[0])) continue; ListLimit limit(c->getString("chan", "*", 1), c->getNum("limit", DEFAULT_LIST_SIZE)); diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp index d38d9f6d0..3c1fc50ef 100644 --- a/src/modules/extra/m_ldap.cpp +++ b/src/modules/extra/m_ldap.cpp @@ -31,8 +31,9 @@ #include "inspircd.h" -#include "threadsocket.h" #include "modules/ldap.h" +#include "threadsocket.h" +#include "utility/string.h" #if defined LDAP_API_FEATURE_X_OPENLDAP_REENTRANT && !LDAP_API_FEATURE_X_OPENLDAP_REENTRANT # error InspIRCd requires OpenLDAP to be built as reentrant. @@ -245,12 +246,12 @@ private: if (up.field_set & (1 << UF_SCHEMA)) { const std::string schema(url, up.field_data[UF_SCHEMA].off, up.field_data[UF_SCHEMA].len); - if (stdalgo::string::equalsci(schema, "ldaps")) + if (insp::equalsci(schema, "ldaps")) { port = 636; // Default encrypted port. secure = true; } - else if (!stdalgo::string::equalsci(schema, "ldap")) + else if (!insp::equalsci(schema, "ldap")) return LDAP_CONNECT_ERROR; // Invalid protocol. } @@ -359,9 +360,9 @@ public: , config(tag) { std::string scope = config->getString("searchscope"); - if (stdalgo::string::equalsci(scope, "base")) + if (insp::equalsci(scope, "base")) searchscope = LDAP_SCOPE_BASE; - else if (stdalgo::string::equalsci(scope, "onelevel")) + else if (insp::equalsci(scope, "onelevel")) searchscope = LDAP_SCOPE_ONELEVEL; else searchscope = LDAP_SCOPE_SUBTREE; @@ -618,7 +619,7 @@ public: for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database")) { - if (!stdalgo::string::equalsci(tag->getString("module"), "ldap")) + if (!insp::equalsci(tag->getString("module"), "ldap")) continue; std::string id = tag->getString("id"); diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 90256c900..e063185ae 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -42,6 +42,7 @@ #include "inspircd.h" #include "modules/sql.h" #include "threadsocket.h" +#include "utility/string.h" #ifdef _WIN32 # pragma comment(lib, "mysqlclient.lib") @@ -478,7 +479,7 @@ void ModuleSQL::ReadConfig(ConfigStatus& status) for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database")) { - if (!stdalgo::string::equalsci(tag->getString("module"), "mysql")) + if (!insp::equalsci(tag->getString("module"), "mysql")) continue; std::string id = tag->getString("id"); diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 237d252ef..97476d2d5 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -42,6 +42,7 @@ #include "inspircd.h" #include "modules/sql.h" +#include "utility/string.h" /* SQLConn rewritten by peavey to * use EventHandler instead of @@ -603,7 +604,7 @@ public: for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database")) { - if (!stdalgo::string::equalsci(tag->getString("module"), "pgsql")) + if (!insp::equalsci(tag->getString("module"), "pgsql")) continue; std::string id = tag->getString("id"); diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index b84e9daf0..b98e4bc9c 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -37,6 +37,7 @@ #include "inspircd.h" #include "modules/sql.h" +#include "utility/string.h" #include @@ -268,7 +269,7 @@ public: for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database")) { - if (!stdalgo::string::equalsci(tag->getString("module"), "sqlite")) + if (!insp::equalsci(tag->getString("module"), "sqlite")) continue; auto* conn = new SQLConn(this, tag); diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index f814e8ec4..e260053de 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -42,6 +42,7 @@ #include "inspircd.h" #include "modules/ssl.h" #include "timeutils.h" +#include "utility/string.h" #include #include @@ -1134,7 +1135,7 @@ class ModuleSSLGnuTLS final for (const auto& [_, tag] : tags) { - if (!stdalgo::string::equalsci(tag->getString("provider"), "gnutls")) + if (!insp::equalsci(tag->getString("provider"), "gnutls")) { ServerInstance->Logs.Debug(MODNAME, "Ignoring non-GnuTLS tag at " + tag->source.str()); continue; diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp index 2a628a3e9..879a09591 100644 --- a/src/modules/extra/m_ssl_mbedtls.cpp +++ b/src/modules/extra/m_ssl_mbedtls.cpp @@ -29,6 +29,7 @@ #include "inspircd.h" #include "modules/ssl.h" #include "timeutils.h" +#include "utility/string.h" #ifdef _WIN32 # define timegm _mkgmtime @@ -931,7 +932,7 @@ private: for (const auto& [_, tag] : tags) { - if (!stdalgo::string::equalsci(tag->getString("provider"), "mbedtls")) + if (!insp::equalsci(tag->getString("provider"), "mbedtls")) { ServerInstance->Logs.Debug(MODNAME, "Ignoring non-mbedTLS tag at " + tag->source.str()); continue; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index ed0e58f32..77fc0f7d0 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -44,6 +44,7 @@ #include "iohook.h" #include "modules/ssl.h" #include "timeutils.h" +#include "utility/string.h" #include #include @@ -216,11 +217,11 @@ namespace OpenSSL /* Set CRL mode */ unsigned long crlflags = X509_V_FLAG_CRL_CHECK; - if (stdalgo::string::equalsci(crlmode, "chain")) + if (insp::equalsci(crlmode, "chain")) { crlflags |= X509_V_FLAG_CRL_CHECK_ALL; } - else if (!stdalgo::string::equalsci(crlmode, "leaf")) + else if (!insp::equalsci(crlmode, "leaf")) { throw ModuleException(thismod, "Unknown mode '" + crlmode + "'; expected either 'chain' (default) or 'leaf'"); } @@ -977,7 +978,7 @@ class ModuleSSLOpenSSL final for (const auto& [_, tag] : tags) { - if (!stdalgo::string::equalsci(tag->getString("provider"), "openssl")) + if (!insp::equalsci(tag->getString("provider"), "openssl")) { ServerInstance->Logs.Debug(MODNAME, "Ignoring non-OpenSSL tag at " + tag->source.str()); continue; diff --git a/src/modules/m_account.cpp b/src/modules/m_account.cpp index 38b3ec6b2..03426cbe4 100644 --- a/src/modules/m_account.cpp +++ b/src/modules/m_account.cpp @@ -327,7 +327,7 @@ public: ModResult OnPreChangeConnectClass(LocalUser* user, const std::shared_ptr& klass, std::optional& errnum) override { const char* error = nullptr; - if (stdalgo::string::equalsci(klass->config->getString("requireaccount"), "nick")) + if (insp::equalsci(klass->config->getString("requireaccount"), "nick")) { if (!accountapi.GetAccountName(user) && !accountapi.IsIdentifiedToNick(user)) error = "an account matching their current nickname"; diff --git a/src/modules/m_cloak_sha256.cpp b/src/modules/m_cloak_sha256.cpp index 9e73de0c7..171cf2585 100644 --- a/src/modules/m_cloak_sha256.cpp +++ b/src/modules/m_cloak_sha256.cpp @@ -42,6 +42,7 @@ typedef void psl_ctx_t; #include "inspircd.h" #include "modules/cloak.h" #include "modules/hash.h" +#include "utility/string.h" class SHA256Method final : public Cloak::Method @@ -313,7 +314,7 @@ public: if (cloakhost && !psldb.empty()) { #ifdef HAS_LIBPSL - if (stdalgo::string::equalsci(psldb, "system")) + if (insp::equalsci(psldb, "system")) { psldb = psl_dist_filename(); if (psldb.empty()) diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 037e2f769..591904e6c 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -125,7 +125,7 @@ public: throw ModuleException(this, " is empty at " + tag->source.str()); const std::string hash = tag->getString("hash", "plaintext", 1); - if (stdalgo::string::equalsci(hash, "plaintext")) + if (insp::equalsci(hash, "plaintext")) { ServerInstance->Logs.Normal(MODNAME, " tag for {} at {} contains an plain text password, this is insecure!", name, tag->source.str()); diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 7607f54a4..254d845da 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -491,7 +491,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 (stdalgo::string::equalsci(bf.action, "allow")) + if (insp::equalsci(bf.action, "allow")) return MOD_RES_PASSTHRU; else { diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 4207741e7..d00d422d9 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -136,14 +136,14 @@ public: }); const std::string typestr = tag->getString("type"); - if (stdalgo::string::equalsci(typestr, "bitmask")) + if (insp::equalsci(typestr, "bitmask")) { type = Type::BITMASK; bitmask = tag->getNum<unsigned int>("bitmask", 0); records = 0; } - else if (stdalgo::string::equalsci(typestr, "record")) + else if (insp::equalsci(typestr, "record")) { type = Type::RECORD; diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 3608d22d8..4ccf03907 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -40,6 +40,7 @@ #include "modules/stats.h" #include "numerichelper.h" #include "timeutils.h" +#include "utility/string.h" #include "xline.h" #include <fstream> @@ -824,21 +825,21 @@ std::pair<bool, std::string> ModuleFilter::AddFilter(const std::string& freeform bool ModuleFilter::StringToFilterAction(const std::string& str, FilterAction& fa) { - if (stdalgo::string::equalsci(str, "gline")) + if (insp::equalsci(str, "gline")) fa = FA_GLINE; - else if (stdalgo::string::equalsci(str, "zline")) + else if (insp::equalsci(str, "zline")) fa = FA_ZLINE; - else if (stdalgo::string::equalsci(str, "warn")) + else if (insp::equalsci(str, "warn")) fa = FA_WARN; - else if (stdalgo::string::equalsci(str, "block")) + else if (insp::equalsci(str, "block")) fa = FA_BLOCK; - else if (stdalgo::string::equalsci(str, "silent")) + else if (insp::equalsci(str, "silent")) fa = FA_SILENT; - else if (stdalgo::string::equalsci(str, "kill")) + else if (insp::equalsci(str, "kill")) fa = FA_KILL; - else if (stdalgo::string::equalsci(str, "shun") && (ServerInstance->XLines->GetFactory("SHUN"))) + else if (insp::equalsci(str, "shun") && (ServerInstance->XLines->GetFactory("SHUN"))) fa = FA_SHUN; - else if (stdalgo::string::equalsci(str, "none")) + else if (insp::equalsci(str, "none")) fa = FA_NONE; else return false; diff --git a/src/modules/m_gateway.cpp b/src/modules/m_gateway.cpp index 2e256f9e9..33e2f10f7 100644 --- a/src/modules/m_gateway.cpp +++ b/src/modules/m_gateway.cpp @@ -369,13 +369,13 @@ public: // Determine what lookup type this host uses. const std::string type = tag->getString("type"); - if (stdalgo::string::equalsci(type, "username") || stdalgo::string::equalsci(type, "ident")) + if (insp::equalsci(type, "username") || insp::equalsci(type, "ident")) { // The IP address should be looked up from the hex IP address. const std::string newuser = tag->getString("newusername", tag->getString("newident", "gateway", ServerInstance->IsUser), ServerInstance->IsUser); userhosts.emplace_back(masks, newuser); } - else if (stdalgo::string::equalsci(type, "webirc")) + else if (insp::equalsci(type, "webirc")) { // The IP address will be received via the WEBIRC command. const std::string fingerprint = tag->getString("fingerprint"); @@ -387,7 +387,7 @@ public: if (fingerprint.empty() && password.empty()) throw ModuleException(this, "When using <" + tag->name + " type=\"webirc\"> either the fingerprint or password field is required, at " + tag->source.str()); - if (!password.empty() && stdalgo::string::equalsci(passwordhash, "plaintext")) + if (!password.empty() && insp::equalsci(passwordhash, "plaintext")) { ServerInstance->Logs.Normal(MODNAME, "<{}> tag at {} contains an plain text password, this is insecure!", tag->name, tag->source.str()); diff --git a/src/modules/m_geoclass.cpp b/src/modules/m_geoclass.cpp index 901d51332..646538dfc 100644 --- a/src/modules/m_geoclass.cpp +++ b/src/modules/m_geoclass.cpp @@ -20,6 +20,7 @@ #include "inspircd.h" #include "modules/geolocation.h" #include "modules/stats.h" +#include "utility/string.h" class ModuleGeoClass final : public Module @@ -59,7 +60,7 @@ public: // If the user matches this country code then they can use this // connect class. - if (stdalgo::string::equalsci(token, code)) + if (insp::equalsci(token, code)) return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 649dc83b2..c42c6e729 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -438,7 +438,7 @@ public: ModResult OnAcceptConnection(int nfd, ListenSocket* from, const irc::sockets::sockaddrs& client, const irc::sockets::sockaddrs& server) override { - if (!stdalgo::string::equalsci(from->bind_tag->getString("type"), "httpd")) + if (!insp::equalsci(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/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index e9a03123a..c7fc68d45 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -25,6 +25,7 @@ #include "inspircd.h" #include "modules/httpd.h" +#include "utility/string.h" class HTTPACL final { @@ -78,16 +79,16 @@ public: while (sep.GetToken(type)) { - if (stdalgo::string::equalsci(type, "password")) + if (insp::equalsci(type, "password")) { username = c->getString("username"); password = c->getString("password"); } - else if (stdalgo::string::equalsci(type, "whitelist")) + else if (insp::equalsci(type, "whitelist")) { whitelist = c->getString("whitelist"); } - else if (stdalgo::string::equalsci(type, "blacklist")) + else if (insp::equalsci(type, "blacklist")) { blacklist = c->getString("blacklist"); } diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 5733cc9e3..805ca297c 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -403,9 +403,9 @@ namespace Stats bool desc = params.getBool("desc", false); OrderBy orderby; - if (stdalgo::string::equalsci(sortmethod, "nick")) + if (insp::equalsci(sortmethod, "nick")) orderby = OB_NICK; - else if (stdalgo::string::equalsci(sortmethod, "lastmsg")) + else if (insp::equalsci(sortmethod, "lastmsg")) { orderby = OB_LASTMSG; // We can only check idle times on local users diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index 5fa250b64..06d89e53b 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -57,17 +57,17 @@ namespace modname.append(name.substr(0, endpos)).append(".so"); // Handle renamed modules. - if (stdalgo::string::equalsci(modname, "m_cloak.so") && ServerInstance->Modules.Find("cloak_md5")) + if (insp::equalsci(modname, "m_cloak.so") && ServerInstance->Modules.Find("cloak_md5")) modname = "m_cloaking.so"; - else if (stdalgo::string::equalsci(modname, "m_realnameban.so")) + else if (insp::equalsci(modname, "m_realnameban.so")) modname = "m_gecosban.so"; - else if (stdalgo::string::equalsci(modname, "m_account.so") && ServerInstance->Modules.Find("services")) + else if (insp::equalsci(modname, "m_account.so") && ServerInstance->Modules.Find("services")) modname = "m_services_account.so"; - else if (stdalgo::string::equalsci(modname, "m_services.so")) + else if (insp::equalsci(modname, "m_services.so")) modname = "m_svshold.so"; // Handle modules with changed properties. - else if (stdalgo::string::equalsci(modname, "m_globops.so")) + else if (insp::equalsci(modname, "m_globops.so")) continue; // This module was made VF_OPTCOMMON in v4. } else diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index b3ac34212..9f6565e34 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -38,7 +38,7 @@ SpanningTreeUtilities* Utils = nullptr; ModResult ModuleSpanningTree::OnAcceptConnection(int newsock, ListenSocket* from, const irc::sockets::sockaddrs& client, const irc::sockets::sockaddrs& server) { - if (!stdalgo::string::equalsci(from->bind_tag->getString("type"), "servers")) + if (!insp::equalsci(from->bind_tag->getString("type"), "servers")) return MOD_RES_PASSTHRU; const std::string incomingip = client.addr(); diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 6ea50a564..67b129081 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -423,7 +423,7 @@ public: ssl_cert* cert = cmd.sslapi.GetCertificate(user); const char* error = nullptr; const std::string requiressl = klass->config->getString("requiressl"); - if (stdalgo::string::equalsci(requiressl, "trusted")) + if (insp::equalsci(requiressl, "trusted")) { if (!cert || !cert->IsCAVerified()) error = "a trusted TLS client certificate"; diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 6ea1eb8fe..e409d1efa 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -25,6 +25,7 @@ #include "inspircd.h" +#include "utility/string.h" struct CustomVhost final { @@ -109,7 +110,7 @@ public: throw ModuleException(this, "<vhost:pass> is empty! at " + tag->source.str()); const std::string hash = tag->getString("hash", "plaintext", 1); - if (stdalgo::string::equalsci(hash, "plaintext")) + if (insp::equalsci(hash, "plaintext")) { ServerInstance->Logs.Warning(MODNAME, "<vhost> tag for {} at {} contains an plain text password, this is insecure!", username, tag->source.str()); diff --git a/src/modules/m_websocket.cpp b/src/modules/m_websocket.cpp index dbfbd7d71..40f726b0f 100644 --- a/src/modules/m_websocket.cpp +++ b/src/modules/m_websocket.cpp @@ -22,6 +22,7 @@ #include "inspircd.h" #include "iohook.h" #include "modules/hash.h" +#include "utility/string.h" #define UTF_CPP_CPLUSPLUS 199711L #include <utfcpp/unchecked.h> @@ -458,8 +459,8 @@ class WebSocketHook final { proto.erase(std::remove_if(proto.begin(), proto.end(), ::isspace), proto.end()); - bool is_binary = stdalgo::string::equalsci(proto, "binary.inspircd.org"); - bool is_text = stdalgo::string::equalsci(proto, "text.inspircd.org"); + bool is_binary = insp::equalsci(proto, "binary.inspircd.org"); + bool is_text = insp::equalsci(proto, "text.inspircd.org"); if (is_binary || is_text) { @@ -648,11 +649,11 @@ public: const auto& tag = ServerInstance->Config->ConfValue("websocket"); const std::string defaultmodestr = tag->getString("defaultmode", tag->getBool("sendastext", true) ? "text" : "binary", 1); - if (stdalgo::string::equalsci(defaultmodestr, "reject")) + if (insp::equalsci(defaultmodestr, "reject")) config.defaultmode = WebSocketConfig::DM_REJECT; - else if (stdalgo::string::equalsci(defaultmodestr, "binary")) + else if (insp::equalsci(defaultmodestr, "binary")) config.defaultmode = WebSocketConfig::DM_BINARY; - else if (stdalgo::string::equalsci(defaultmodestr, "text")) + else if (insp::equalsci(defaultmodestr, "text")) config.defaultmode = WebSocketConfig::DM_TEXT; else throw ModuleException(this, defaultmodestr + " is an invalid value for <websocket:defaultmode>; acceptable values are 'binary', 'text' and 'reject', at " + tag->source.str()); diff --git a/src/socket.cpp b/src/socket.cpp index 12f9fabda..c944a06ef 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -32,6 +32,7 @@ #endif #include "inspircd.h" +#include "utility/string.h" namespace { @@ -141,7 +142,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports) irc::spacesepstream protostream(tag->getString("protocols", "all", 1)); for (std::string protocol; protostream.GetToken(protocol); ) { - if (stdalgo::string::equalsci(protocol, "all")) + if (insp::equalsci(protocol, "all")) { protocols.push_back(0); // IPPROTO_TCP #ifdef IPPROTO_SCTP @@ -149,7 +150,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports) protocols.push_back(IPPROTO_SCTP); #endif } - else if (stdalgo::string::equalsci(protocol, "sctp")) + else if (insp::equalsci(protocol, "sctp")) { #ifdef IPPROTO_SCTP protocols.push_back(IPPROTO_SCTP); @@ -157,7 +158,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports) failed_ports.emplace_back("Platform does not support SCTP", tag); #endif } - else if (stdalgo::string::equalsci(protocol, "tcp")) + else if (insp::equalsci(protocol, "tcp")) { protocols.push_back(0); // IPPROTO_TCP } diff --git a/src/users.cpp b/src/users.cpp index af3b518bc..8f58b146c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1076,7 +1076,7 @@ ConnectClass::ConnectClass(const std::shared_ptr<ConfigTag>& tag, Type t, const for (const auto& [key, value] : parent->config->GetItems()) { // The class name and parent name are not inherited - if (stdalgo::string::equalsci(key, "name") || stdalgo::string::equalsci(key, "parent")) + if (insp::equalsci(key, "name") || insp::equalsci(key, "parent")) continue; // Store the item in the config tag. If this item also @@ -1097,7 +1097,7 @@ void ConnectClass::Configure(const std::string& classname, const std::shared_ptr password = tag->getString("password", password); passwordhash = tag->getString("hash", passwordhash); - if (!password.empty() && (passwordhash.empty() || stdalgo::string::equalsci(passwordhash, "plaintext"))) + if (!password.empty() && (passwordhash.empty() || insp::equalsci(passwordhash, "plaintext"))) { ServerInstance->Logs.Normal("CONNECTCLASS", "<connect> tag '{}' at {} contains an plain text password, this is insecure!", name, tag->source.str()); @@ -1270,16 +1270,16 @@ void OperType::MergeTag(const std::shared_ptr<ConfigTag>& tag) { for (const auto& [key, value] : tag->GetItems()) { - if (stdalgo::string::equalsci(key, "name") || stdalgo::string::equalsci(key, "type") - || stdalgo::string::equalsci(key, "classes")) + if (insp::equalsci(key, "name") || insp::equalsci(key, "type") + || insp::equalsci(key, "classes")) { // These are meta keys for linking the oper/type/class tags. continue; } - if (stdalgo::string::equalsci(key, "commands") || stdalgo::string::equalsci(key, "privs") - || stdalgo::string::equalsci(key, "chanmodes") || stdalgo::string::equalsci(key, "usermodes") - || stdalgo::string::equalsci(key, "snomasks")) + if (insp::equalsci(key, "commands") || insp::equalsci(key, "privs") + || insp::equalsci(key, "chanmodes") || insp::equalsci(key, "usermodes") + || insp::equalsci(key, "snomasks")) { // These have already been parsed into the object. continue; -- cgit v1.3.1-10-gc9f91