summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2018-07-24 18:29:43 +0100
committerPeter Powell <petpow@saberuk.com>2018-07-24 21:55:10 +0100
commit97a1d6429a735eb279496df010d04e3f42aa4e22 (patch)
treea201d8ffe678e5929a2b1d373eef8082d8c6150d /src
parent7a24867d97c6ffe75b155d96dedb11b30b904a33 (diff)
Make more config stuff case insensitive.
Diffstat (limited to 'src')
-rw-r--r--src/configparser.cpp14
-rw-r--r--src/listensocket.cpp2
-rw-r--r--src/logger.cpp14
-rw-r--r--src/modules/extra/m_ldap.cpp6
-rw-r--r--src/modules/extra/m_mysql.cpp2
-rw-r--r--src/modules/extra/m_pgsql.cpp2
-rw-r--r--src/modules/extra/m_regex_stdlib.cpp12
-rw-r--r--src/modules/extra/m_sqlite3.cpp2
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp8
-rw-r--r--src/modules/extra/m_ssl_mbedtls.cpp2
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp6
-rw-r--r--src/modules/m_blockamsg.cpp8
-rw-r--r--src/modules/m_cloaking.cpp4
-rw-r--r--src/modules/m_dccallow.cpp2
-rw-r--r--src/modules/m_dnsbl.cpp2
-rw-r--r--src/modules/m_flashpolicyd.cpp4
-rw-r--r--src/modules/m_httpd.cpp2
-rw-r--r--src/modules/m_httpd_acl.cpp6
-rw-r--r--src/modules/m_spanningtree/utils.cpp2
-rw-r--r--src/users.cpp2
20 files changed, 51 insertions, 51 deletions
diff --git a/src/configparser.cpp b/src/configparser.cpp
index 627cd78e1..825053044 100644
--- a/src/configparser.cpp
+++ b/src/configparser.cpp
@@ -213,25 +213,25 @@ struct Parser
mandatory_tag.clear();
}
- if (name == "include")
+ if (stdalgo::string::equalsci(name, "include"))
{
stack.DoInclude(tag, flags);
}
- else if (name == "files")
+ else if (stdalgo::string::equalsci(name, "files"))
{
for(ConfigItems::iterator i = items->begin(); i != items->end(); i++)
{
stack.DoReadFile(i->first, i->second, flags, false);
}
}
- else if (name == "execfiles")
+ else if (stdalgo::string::equalsci(name, "execfiles"))
{
for(ConfigItems::iterator i = items->begin(); i != items->end(); i++)
{
stack.DoReadFile(i->first, i->second, flags, true);
}
}
- else if (name == "define")
+ else if (stdalgo::string::equalsci(name, "define"))
{
if (flags & FLAG_USE_COMPAT)
throw CoreException("<define> tags may only be used in XML-style config (add <config format=\"xml\">)");
@@ -241,12 +241,12 @@ struct Parser
throw CoreException("Variable definition must include variable name");
stack.vars[varname] = value;
}
- else if (name == "config")
+ else if (stdalgo::string::equalsci(name, "config"))
{
std::string format = tag->getString("format");
- if (format == "xml")
+ if (stdalgo::string::equalsci(format, "xml"))
flags &= ~FLAG_USE_COMPAT;
- else if (format == "compat")
+ else if (stdalgo::string::equalsci(format, "compat"))
flags |= FLAG_USE_COMPAT;
else if (!format.empty())
throw CoreException("Unknown configuration format " + format);
diff --git a/src/listensocket.cpp b/src/listensocket.cpp
index 5ecaab460..60ee0b449 100644
--- a/src/listensocket.cpp
+++ b/src/listensocket.cpp
@@ -183,7 +183,7 @@ void ListenSocket::OnEventHandlerRead()
if (res == MOD_RES_PASSTHRU)
{
std::string type = bind_tag->getString("type", "clients");
- if (type == "clients")
+ if (stdalgo::string::equalsci(type, "clients"))
{
ServerInstance->Users->AddUser(incomingSockfd, this, &client, &server);
res = MOD_RES_ALLOW;
diff --git a/src/logger.cpp b/src/logger.cpp
index 22896bd4f..b9f9bae0b 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -77,35 +77,35 @@ void LogManager::OpenFileLogs()
{
ConfigTag* tag = i->second;
std::string method = tag->getString("method");
- if (method != "file")
+ if (!stdalgo::string::equalsci(method, "file"))
{
continue;
}
std::string type = tag->getString("type");
std::string level = tag->getString("level");
LogLevel loglevel = LOG_DEFAULT;
- if (level == "rawio")
+ if (stdalgo::string::equalsci(level, "rawio"))
{
loglevel = LOG_RAWIO;
ServerInstance->Config->RawLog = true;
}
- else if (level == "debug")
+ else if (stdalgo::string::equalsci(level, "debug"))
{
loglevel = LOG_DEBUG;
}
- else if (level == "verbose")
+ else if (stdalgo::string::equalsci(level, "verbose"))
{
loglevel = LOG_VERBOSE;
}
- else if (level == "default")
+ else if (stdalgo::string::equalsci(level, "default"))
{
loglevel = LOG_DEFAULT;
}
- else if (level == "sparse")
+ else if (stdalgo::string::equalsci(level, "sparse"))
{
loglevel = LOG_SPARSE;
}
- else if (level == "none")
+ else if (stdalgo::string::equalsci(level, "none"))
{
loglevel = LOG_NONE;
}
diff --git a/src/modules/extra/m_ldap.cpp b/src/modules/extra/m_ldap.cpp
index f3ace5409..8c2752dbf 100644
--- a/src/modules/extra/m_ldap.cpp
+++ b/src/modules/extra/m_ldap.cpp
@@ -258,9 +258,9 @@ class LDAPService : public LDAPProvider, public SocketThread
, con(NULL), config(tag), last_connect(0)
{
std::string scope = config->getString("searchscope");
- if (scope == "base")
+ if (stdalgo::string::equalsci(scope, "base"))
searchscope = LDAP_SCOPE_BASE;
- else if (scope == "onelevel")
+ else if (stdalgo::string::equalsci(scope, "onelevel"))
searchscope = LDAP_SCOPE_ONELEVEL;
else
searchscope = LDAP_SCOPE_SUBTREE;
@@ -533,7 +533,7 @@ class ModuleLDAP : public Module
{
const reference<ConfigTag>& tag = i->second;
- if (tag->getString("module") != "ldap")
+ if (!stdalgo::string::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 9f17c1426..45ba67e4e 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -427,7 +427,7 @@ void ModuleSQL::ReadConfig(ConfigStatus& status)
ConfigTagList tags = ServerInstance->Config->ConfTags("database");
for(ConfigIter i = tags.first; i != tags.second; i++)
{
- if (i->second->getString("module", "mysql") != "mysql")
+ if (!stdalgo::string::equalsci(i->second->getString("provider"), "mysql"))
continue;
std::string id = i->second->getString("id");
ConnMap::iterator curr = connections.find(id);
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 8beea1265..220168b84 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -546,7 +546,7 @@ class ModulePgSQL : public Module
ConfigTagList tags = ServerInstance->Config->ConfTags("database");
for(ConfigIter i = tags.first; i != tags.second; i++)
{
- if (i->second->getString("module", "pgsql") != "pgsql")
+ if (!stdalgo::string::equalsci(i->second->getString("provider"), "pgsql"))
continue;
std::string id = i->second->getString("id");
ConnMap::iterator curr = connections.find(id);
diff --git a/src/modules/extra/m_regex_stdlib.cpp b/src/modules/extra/m_regex_stdlib.cpp
index 7a888ed72..42e5c8bf1 100644
--- a/src/modules/extra/m_regex_stdlib.cpp
+++ b/src/modules/extra/m_regex_stdlib.cpp
@@ -74,19 +74,19 @@ public:
ConfigTag* Conf = ServerInstance->Config->ConfValue("stdregex");
std::string regextype = Conf->getString("type", "ecmascript");
- if(regextype == "bre")
+ if (stdalgo::string::equalsci(regextype, "bre"))
ref.regextype = std::regex::basic;
- else if(regextype == "ere")
+ else if (stdalgo::string::equalsci(regextype, "ere"))
ref.regextype = std::regex::extended;
- else if(regextype == "awk")
+ else if (stdalgo::string::equalsci(regextype, "awk"))
ref.regextype = std::regex::awk;
- else if(regextype == "grep")
+ else if (stdalgo::string::equalsci(regextype, "grep"))
ref.regextype = std::regex::grep;
- else if(regextype == "egrep")
+ else if (stdalgo::string::equalsci(regextype, "egrep"))
ref.regextype = std::regex::egrep;
else
{
- if(regextype != "ecmascript")
+ if (!stdalgo::string::equalsci(regextype, "ecmascript"))
ServerInstance->SNO->WriteToSnoMask('a', "WARNING: Non-existent regex engine '%s' specified. Falling back to ECMAScript.", regextype.c_str());
ref.regextype = std::regex::ECMAScript;
}
diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp
index 31821045d..2029181bf 100644
--- a/src/modules/extra/m_sqlite3.cpp
+++ b/src/modules/extra/m_sqlite3.cpp
@@ -254,7 +254,7 @@ class ModuleSQLite3 : public Module
ConfigTagList tags = ServerInstance->Config->ConfTags("database");
for(ConfigIter i = tags.first; i != tags.second; i++)
{
- if (i->second->getString("module", "sqlite") != "sqlite")
+ if (!stdalgo::string::equalsci(i->second->getString("provider"), "sqlite"))
continue;
SQLConn* conn = new SQLConn(this, i->second);
conns.insert(std::make_pair(i->second->getString("id"), conn));
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 51410cfb2..d7ca20742 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -184,12 +184,12 @@ namespace GnuTLS
throw Exception("Unknown hash type " + hashname);
gnutls_hash_deinit(is_digest, NULL);
#else
- if (hashname == "md5")
+ if (stdalgo::string::equalsci(hashname, "md5"))
hash = GNUTLS_DIG_MD5;
- else if (hashname == "sha1")
+ else if (stdalgo::string::equalsci(hashname, "sha1"))
hash = GNUTLS_DIG_SHA1;
#ifdef INSPIRCD_GNUTLS_ENABLE_SHA256_FINGERPRINT
- else if (hashname == "sha256")
+ else if (stdalgo::string::equalsci(hashname, "sha256"))
hash = GNUTLS_DIG_SHA256;
#endif
else
@@ -1298,7 +1298,7 @@ class ModuleSSLGnuTLS : public Module
for (ConfigIter i = tags.first; i != tags.second; ++i)
{
ConfigTag* tag = i->second;
- if (tag->getString("provider") != "gnutls")
+ if (!stdalgo::string::equalsci(tag->getString("provider"), "gnutls"))
continue;
std::string name = tag->getString("name");
diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp
index 8bb0e2bbd..75b25fbc4 100644
--- a/src/modules/extra/m_ssl_mbedtls.cpp
+++ b/src/modules/extra/m_ssl_mbedtls.cpp
@@ -876,7 +876,7 @@ class ModuleSSLmbedTLS : public Module
for (ConfigIter i = tags.first; i != tags.second; ++i)
{
ConfigTag* tag = i->second;
- if (tag->getString("provider") != "mbedtls")
+ if (!stdalgo::string::equalsci(tag->getString("provider"), "mbedtls"))
continue;
std::string name = tag->getString("name");
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index a70bffb3c..5f61c71a9 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -222,11 +222,11 @@ namespace OpenSSL
/* Set CRL mode */
unsigned long crlflags = X509_V_FLAG_CRL_CHECK;
- if (crlmode == "chain")
+ if (stdalgo::string::equalsci(crlmode, "chain"))
{
crlflags |= X509_V_FLAG_CRL_CHECK_ALL;
}
- else if (crlmode != "leaf")
+ else if (!stdalgo::string::equalsci(crlmode, "leaf"))
{
throw ModuleException("Unknown mode '" + crlmode + "'; expected either 'chain' (default) or 'leaf'");
}
@@ -963,7 +963,7 @@ class ModuleSSLOpenSSL : public Module
for (ConfigIter i = tags.first; i != tags.second; ++i)
{
ConfigTag* tag = i->second;
- if (tag->getString("provider") != "openssl")
+ if (!stdalgo::string::equalsci(tag->getString("provider"), "openssl"))
continue;
std::string name = tag->getString("name");
diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp
index ed0e486e9..097041896 100644
--- a/src/modules/m_blockamsg.cpp
+++ b/src/modules/m_blockamsg.cpp
@@ -69,13 +69,13 @@ class ModuleBlockAmsg : public Module
ForgetDelay = tag->getDuration("delay", 3);
std::string act = tag->getString("action");
- if (act == "notice")
+ if (stdalgo::string::equalsci(act, "notice"))
action = IBLOCK_NOTICE;
- else if (act == "noticeopers")
+ else if (stdalgo::string::equalsci(act, "noticeopers"))
action = IBLOCK_NOTICEOPERS;
- else if (act == "silent")
+ else if (stdalgo::string::equalsci(act, "silent"))
action = IBLOCK_SILENT;
- else if (act == "kill")
+ else if (stdalgo::string::equalsci(act, "kill"))
action = IBLOCK_KILL;
else
action = IBLOCK_KILLOPERS;
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index 75dc889f9..ad4b958c5 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -350,12 +350,12 @@ class ModuleCloaking : public Module
suffix = tag->getString("suffix", ".IP");
std::string modestr = tag->getString("mode");
- if (modestr == "half")
+ if (stdalgo::string::equalsci(modestr, "half"))
{
mode = MODE_HALF_CLOAK;
domainparts = tag->getUInt("domainparts", 3, 1, 10);
}
- else if (modestr == "full")
+ else if (stdalgo::string::equalsci(modestr, "full"))
mode = MODE_OPAQUE;
else
throw ModuleException("Bad value for <cloak:mode>; must be half or full");
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index 9d85f01da..647f69e7a 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -391,7 +391,7 @@ class ModuleDCCAllow : public Module
if (InspIRCd::Match(filename, bfl[i].filemask, ascii_case_insensitive_map))
{
/* We have a matching badfile entry, override whatever the default action is */
- if (bfl[i].action == "allow")
+ if (stdalgo::string::equalsci(bfl[i].action, "allow"))
return MOD_RES_PASSTHRU;
else
{
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index 10b0e2728..e0a827f04 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -278,7 +278,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener
e->reason = tag->getString("reason");
e->domain = tag->getString("domain");
- if (tag->getString("type") == "bitmask")
+ if (stdalgo::string::equalsci(tag->getString("type"), "bitmask"))
{
e->type = DNSBLConfEntry::A_BITMASK;
e->bitmask = tag->getUInt("bitmask", 0, 0, UINT_MAX);
diff --git a/src/modules/m_flashpolicyd.cpp b/src/modules/m_flashpolicyd.cpp
index 4e7af4b83..d7f9a793b 100644
--- a/src/modules/m_flashpolicyd.cpp
+++ b/src/modules/m_flashpolicyd.cpp
@@ -84,7 +84,7 @@ class ModuleFlashPD : public Module
public:
ModResult OnAcceptConnection(int nfd, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE
{
- if (from->bind_tag->getString("type") != "flashpolicyd")
+ if (!stdalgo::string::equalsci(from->bind_tag->getString("type"), "flashpolicyd"))
return MOD_RES_PASSTHRU;
if (policy_reply.empty())
@@ -123,7 +123,7 @@ class ModuleFlashPD : public Module
for (std::vector<ListenSocket*>::const_iterator i = ServerInstance->ports.begin(); i != ServerInstance->ports.end(); ++i)
{
ListenSocket* ls = *i;
- if (ls->bind_tag->getString("type", "clients") != "clients" || ls->bind_tag->getString("ssl", "plaintext") != "plaintext")
+ if (!stdalgo::string::equalsci(ls->bind_tag->getString("type", "clients"), "clients") || !ls->bind_tag->getString("ssl").empty())
continue;
to_ports.append(ConvToStr(ls->bind_sa.port())).push_back(',');
diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp
index a20b85f9d..17f25203d 100644
--- a/src/modules/m_httpd.cpp
+++ b/src/modules/m_httpd.cpp
@@ -406,7 +406,7 @@ class ModuleHttpServer : public Module
ModResult OnAcceptConnection(int nfd, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE
{
- if (from->bind_tag->getString("type") != "httpd")
+ if (!stdalgo::string::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 3f67fffca..2dbc1be69 100644
--- a/src/modules/m_httpd_acl.cpp
+++ b/src/modules/m_httpd_acl.cpp
@@ -67,16 +67,16 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener
while (sep.GetToken(type))
{
- if (type == "password")
+ if (stdalgo::string::equalsci(type, "password"))
{
username = c->getString("username");
password = c->getString("password");
}
- else if (type == "whitelist")
+ else if (stdalgo::string::equalsci(type, "whitelist"))
{
whitelist = c->getString("whitelist");
}
- else if (type == "blacklist")
+ else if (stdalgo::string::equalsci(type, "blacklist"))
{
blacklist = c->getString("blacklist");
}
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index f42822daa..cde627e21 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -33,7 +33,7 @@ SpanningTreeUtilities* Utils = NULL;
ModResult ModuleSpanningTree::OnAcceptConnection(int newsock, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server)
{
- if (from->bind_tag->getString("type") != "servers")
+ if (!stdalgo::string::equalsci(from->bind_tag->getString("type"), "servers"))
return MOD_RES_PASSTHRU;
std::string incomingip = client->addr();
diff --git a/src/users.cpp b/src/users.cpp
index 7a34b31b1..04a8f959a 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1231,7 +1231,7 @@ ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask, cons
for (ConfigItems::const_iterator piter = parentkeys.begin(); piter != parentkeys.end(); ++piter)
{
// The class name and parent name are not inherited
- if (piter->first == "name" || piter->first == "parent")
+ if (stdalgo::string::equalsci(piter->first, "name") || stdalgo::string::equalsci(piter->first, "parent"))
continue;
// Store the item in the config tag. If this item also