summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_geo_maxmind.cpp2
-rw-r--r--src/modules/extra/m_regex_stdlib.cpp2
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp8
-rw-r--r--src/modules/extra/m_ssl_mbedtls.cpp8
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp18
-rw-r--r--src/modules/m_anticaps.cpp2
-rw-r--r--src/modules/m_blockcaps.cpp2
-rw-r--r--src/modules/m_chghost.cpp5
-rw-r--r--src/modules/m_customtitle.cpp2
-rw-r--r--src/modules/m_filter.cpp2
-rw-r--r--src/modules/m_flashpolicyd.cpp5
-rw-r--r--src/modules/m_hostchange.cpp4
-rw-r--r--src/modules/m_nationalchars.cpp2
-rw-r--r--src/modules/m_opermotd.cpp2
-rw-r--r--src/modules/m_passforward.cpp2
-rw-r--r--src/modules/m_randquote.cpp2
-rw-r--r--src/modules/m_sethost.cpp5
-rw-r--r--src/modules/m_sqloper.cpp2
-rw-r--r--src/modules/m_xline_db.cpp2
19 files changed, 42 insertions, 35 deletions
diff --git a/src/modules/extra/m_geo_maxmind.cpp b/src/modules/extra/m_geo_maxmind.cpp
index 0cf082775..984a2c6cb 100644
--- a/src/modules/extra/m_geo_maxmind.cpp
+++ b/src/modules/extra/m_geo_maxmind.cpp
@@ -160,7 +160,7 @@ class ModuleGeoMaxMind : public Module
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
ConfigTag* tag = ServerInstance->Config->ConfValue("maxmind");
- const std::string file = ServerInstance->Config->Paths.PrependConfig(tag->getString("file", "GeoLite2-Country.mmdb"));
+ const std::string file = ServerInstance->Config->Paths.PrependConfig(tag->getString("file", "GeoLite2-Country.mmdb", 1));
// Try to read the new database.
MMDB_s mmdb;
diff --git a/src/modules/extra/m_regex_stdlib.cpp b/src/modules/extra/m_regex_stdlib.cpp
index 418237dd1..80cf299f1 100644
--- a/src/modules/extra/m_regex_stdlib.cpp
+++ b/src/modules/extra/m_regex_stdlib.cpp
@@ -75,8 +75,8 @@ public:
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
ConfigTag* Conf = ServerInstance->Config->ConfValue("stdregex");
- std::string regextype = Conf->getString("type", "ecmascript");
+ const std::string regextype = Conf->getString("type", "ecmascript", 1);
if (stdalgo::string::equalsci(regextype, "bre"))
ref.regextype = std::regex::basic;
else if (stdalgo::string::equalsci(regextype, "ere"))
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index bc8b0b472..1953851e3 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -664,12 +664,12 @@ namespace GnuTLS
Config(const std::string& profilename, ConfigTag* tag)
: name(profilename)
- , certstr(ReadFile(tag->getString("certfile", "cert.pem")))
- , keystr(ReadFile(tag->getString("keyfile", "key.pem")))
- , dh(DHParams::Import(ReadFile(tag->getString("dhfile", "dhparams.pem"))))
+ , certstr(ReadFile(tag->getString("certfile", "cert.pem", 1)))
+ , keystr(ReadFile(tag->getString("keyfile", "key.pem", 1)))
+ , dh(DHParams::Import(ReadFile(tag->getString("dhfile", "dhparams.pem", 1))))
, priostr(GetPrioStr(profilename, tag))
, mindh(tag->getUInt("mindhbits", 1024))
- , hashstr(tag->getString("hash", "md5"))
+ , hashstr(tag->getString("hash", "md5", 1))
, requestclientcert(tag->getBool("requestclientcert", true))
{
// Load trusted CA and revocation list, if set
diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp
index a1e0c9f28..d330afe51 100644
--- a/src/modules/extra/m_ssl_mbedtls.cpp
+++ b/src/modules/extra/m_ssl_mbedtls.cpp
@@ -419,13 +419,13 @@ namespace mbedTLS
Config(const std::string& profilename, ConfigTag* tag, CTRDRBG& ctr_drbg)
: name(profilename)
, ctrdrbg(ctr_drbg)
- , certstr(ReadFile(tag->getString("certfile", "cert.pem")))
- , keystr(ReadFile(tag->getString("keyfile", "key.pem")))
- , dhstr(ReadFile(tag->getString("dhfile", "dhparams.pem")))
+ , certstr(ReadFile(tag->getString("certfile", "cert.pem", 1)))
+ , keystr(ReadFile(tag->getString("keyfile", "key.pem", 1)))
+ , dhstr(ReadFile(tag->getString("dhfile", "dhparams.pem", 1)))
, ciphersuitestr(tag->getString("ciphersuites"))
, curvestr(tag->getString("curves"))
, mindh(tag->getUInt("mindhbits", 2048))
- , hashstr(tag->getString("hash", "sha256"))
+ , hashstr(tag->getString("hash", "sha256", 1))
, castr(tag->getString("cafile"))
, minver(tag->getUInt("minver", 0))
, maxver(tag->getUInt("maxver", 0))
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index c27626639..9a5fa98af 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -386,7 +386,7 @@ namespace OpenSSL
public:
Profile(const std::string& profilename, ConfigTag* tag)
: name(profilename)
- , dh(ServerInstance->Config->Paths.PrependConfig(tag->getString("dhfile", "dhparams.pem")))
+ , dh(ServerInstance->Config->Paths.PrependConfig(tag->getString("dhfile", "dhparams.pem", 1)))
, ctx(SSL_CTX_new(SSLv23_server_method()))
, clictx(SSL_CTX_new(SSLv23_client_method()))
, allowrenego(tag->getBool("renegotiation")) // Disallow by default
@@ -395,7 +395,7 @@ namespace OpenSSL
if ((!ctx.SetDH(dh)) || (!clictx.SetDH(dh)))
throw Exception("Couldn't set DH parameters");
- std::string hash = tag->getString("hash", "md5");
+ const std::string hash = tag->getString("hash", "md5", 1);
digest = EVP_get_digestbyname(hash.c_str());
if (digest == NULL)
throw Exception("Unknown hash type " + hash);
@@ -411,7 +411,7 @@ namespace OpenSSL
}
#ifndef OPENSSL_NO_ECDH
- std::string curvename = tag->getString("ecdhcurve", "prime256v1");
+ const std::string curvename = tag->getString("ecdhcurve", "prime256v1", 1);
if (!curvename.empty())
ctx.SetECDH(curvename);
#endif
@@ -422,14 +422,14 @@ namespace OpenSSL
/* Load our keys and certificates
* NOTE: OpenSSL's error logging API sucks, don't blame us for this clusterfuck.
*/
- std::string filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("certfile", "cert.pem"));
+ std::string filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("certfile", "cert.pem", 1));
if ((!ctx.SetCerts(filename)) || (!clictx.SetCerts(filename)))
{
ERR_print_errors_cb(error_callback, this);
throw Exception("Can't read certificate file: " + lasterr);
}
- filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("keyfile", "key.pem"));
+ filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("keyfile", "key.pem", 1));
if ((!ctx.SetPrivateKey(filename)) || (!clictx.SetPrivateKey(filename)))
{
ERR_print_errors_cb(error_callback, this);
@@ -437,7 +437,7 @@ namespace OpenSSL
}
// Load the CAs we trust
- filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("cafile", "ca.pem"));
+ filename = ServerInstance->Config->Paths.PrependConfig(tag->getString("cafile", "ca.pem", 1));
if ((!ctx.SetCA(filename)) || (!clictx.SetCA(filename)))
{
ERR_print_errors_cb(error_callback, this);
@@ -445,9 +445,9 @@ namespace OpenSSL
}
// Load the CRLs.
- std::string crlfile = tag->getString("crlfile");
- std::string crlpath = tag->getString("crlpath");
- std::string crlmode = tag->getString("crlmode", "chain");
+ const std::string crlfile = tag->getString("crlfile");
+ const std::string crlpath = tag->getString("crlpath");
+ const std::string crlmode = tag->getString("crlmode", "chain", 1);
ctx.SetCRL(crlfile, crlpath, crlmode);
clictx.SetVerifyCert();
diff --git a/src/modules/m_anticaps.cpp b/src/modules/m_anticaps.cpp
index 83fa0ecaa..da023521e 100644
--- a/src/modules/m_anticaps.cpp
+++ b/src/modules/m_anticaps.cpp
@@ -190,7 +190,7 @@ class ModuleAntiCaps : public Module
ConfigTag* tag = ServerInstance->Config->ConfValue("anticaps");
uppercase.reset();
- const std::string upper = tag->getString("uppercase", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ const std::string upper = tag->getString("uppercase", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1);
for (std::string::const_iterator iter = upper.begin(); iter != upper.end(); ++iter)
uppercase.set(static_cast<unsigned char>(*iter));
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index f66a6a763..26c11e082 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -118,7 +118,7 @@ public:
lowercase.set(static_cast<unsigned char>(*iter));
uppercase.reset();
- const std::string upper = tag->getString("uppercase", tag->getString("capsmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
+ const std::string upper = tag->getString("uppercase", tag->getString("capsmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1));
for (std::string::const_iterator iter = upper.begin(); iter != upper.end(); ++iter)
uppercase.set(static_cast<unsigned char>(*iter));
}
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index 1a73af209..d16733033 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -98,10 +98,11 @@ class ModuleChgHost : public Module
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
- std::string hmap = ServerInstance->Config->ConfValue("hostname")->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789");
+ ConfigTag* tag = ServerInstance->Config->ConfValue("hostname");
+ const std::string hmap = tag->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789", 1);
cmd.hostmap.reset();
- for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++)
+ for (std::string::const_iterator n = hmap.begin(); n != hmap.end(); n++)
cmd.hostmap.set(static_cast<unsigned char>(*n));
}
diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp
index 7cdd0bc4f..3bf7e7925 100644
--- a/src/modules/m_customtitle.cpp
+++ b/src/modules/m_customtitle.cpp
@@ -143,7 +143,7 @@ class ModuleCustomTitle : public Module, public Whois::LineEventListener
name.c_str(), tag->getTagLocation().c_str());
}
- std::string host = tag->getString("host", "*@*");
+ std::string host = tag->getString("host", "*@*", 1);
std::string title = tag->getString("title");
std::string vhost = tag->getString("vhost");
CustomTitle config(name, pass, hash, host, title, vhost);
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 3e7652509..9325c243d 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -624,7 +624,7 @@ void ModuleFilter::ReadConfig(ConfigStatus& status)
ConfigTag* tag = i->second;
// If "target" is not found, try the old "channel" key to keep compatibility with 2.0 configs
- const std::string target = tag->getString("target", tag->getString("channel"));
+ const std::string target = tag->getString("target", tag->getString("channel"), 1);
if (!target.empty())
{
if (target[0] == '#')
diff --git a/src/modules/m_flashpolicyd.cpp b/src/modules/m_flashpolicyd.cpp
index 82ea97a5b..c8fb71e83 100644
--- a/src/modules/m_flashpolicyd.cpp
+++ b/src/modules/m_flashpolicyd.cpp
@@ -124,7 +124,10 @@ class ModuleFlashPD : public Module
for (std::vector<ListenSocket*>::const_iterator i = ServerInstance->ports.begin(); i != ServerInstance->ports.end(); ++i)
{
ListenSocket* ls = *i;
- if (!stdalgo::string::equalsci(ls->bind_tag->getString("type", "clients"), "clients") || !ls->bind_tag->getString("ssl").empty())
+ if (!stdalgo::string::equalsci(ls->bind_tag->getString("type", "clients", 1), "clients"))
+ continue;
+
+ if (!ls->bind_tag->getString("ssl").empty())
continue;
to_ports.append(ConvToStr(ls->bind_sa.port())).push_back(',');
diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp
index 3529b6a4a..78ef68759 100644
--- a/src/modules/m_hostchange.cpp
+++ b/src/modules/m_hostchange.cpp
@@ -176,7 +176,9 @@ private:
}
}
- const std::string hmap = ServerInstance->Config->ConfValue("hostname")->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789");
+ ConfigTag* tag = ServerInstance->Config->ConfValue("hostname");
+ const std::string hmap = tag->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789", 1);
+
hostmap.reset();
for (std::string::const_iterator iter = hmap.begin(); iter != hmap.end(); ++iter)
hostmap.set(static_cast<unsigned char>(*iter));
diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp
index 9a875fca2..d86122c59 100644
--- a/src/modules/m_nationalchars.cpp
+++ b/src/modules/m_nationalchars.cpp
@@ -274,7 +274,7 @@ class ModuleNationalChars : public Module
{
ConfigTag* tag = ServerInstance->Config->ConfValue("nationalchars");
charset = tag->getString("file");
- std::string casemapping = tag->getString("casemapping", FileSystem::GetFileName(charset));
+ std::string casemapping = tag->getString("casemapping", FileSystem::GetFileName(charset), 1);
if (casemapping.find(' ') != std::string::npos)
throw ModuleException("<nationalchars:casemapping> must not contain any spaces!");
ServerInstance->Config->CaseMapping = casemapping;
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index 36998a4b3..585b651b6 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -114,7 +114,7 @@ class ModuleOpermotd : public Module
try
{
- FileReader reader(conf->getString("file", "opermotd"));
+ FileReader reader(conf->getString("file", "opermotd", 1));
cmd.opermotd = reader.GetVector();
InspIRCd::ProcessColors(cmd.opermotd);
}
diff --git a/src/modules/m_passforward.cpp b/src/modules/m_passforward.cpp
index 40d04de67..abbd9893d 100644
--- a/src/modules/m_passforward.cpp
+++ b/src/modules/m_passforward.cpp
@@ -41,7 +41,7 @@ class ModulePassForward : public Module
ConfigTag* tag = ServerInstance->Config->ConfValue("passforward");
nickrequired = tag->getString("nick", "NickServ");
forwardmsg = tag->getString("forwardmsg", "NOTICE $nick :*** Forwarding PASS to $nickrequired");
- forwardcmd = tag->getString("cmd", "SQUERY $nickrequired :IDENTIFY $pass");
+ forwardcmd = tag->getString("cmd", "SQUERY $nickrequired :IDENTIFY $pass", 1);
}
void FormatStr(std::string& result, const std::string& format, const LocalUser* user)
diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp
index fada120ad..184b06f8b 100644
--- a/src/modules/m_randquote.cpp
+++ b/src/modules/m_randquote.cpp
@@ -37,7 +37,7 @@ class ModuleRandQuote : public Module
ConfigTag* conf = ServerInstance->Config->ConfValue("randquote");
prefix = conf->getString("prefix");
suffix = conf->getString("suffix");
- FileReader reader(conf->getString("file", "quotes"));
+ FileReader reader(conf->getString("file", "quotes", 1));
quotes = reader.GetVector();
}
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index 2bacded6f..022434ec9 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -80,10 +80,11 @@ class ModuleSetHost : public Module
void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
{
- std::string hmap = ServerInstance->Config->ConfValue("hostname")->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789");
+ ConfigTag* tag = ServerInstance->Config->ConfValue("hostname");
+ const std::string hmap = tag->getString("charmap", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789", 1);
cmd.hostmap.reset();
- for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++)
+ for (std::string::const_iterator n = hmap.begin(); n != hmap.end(); n++)
cmd.hostmap.set(static_cast<unsigned char>(*n));
}
diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp
index df8f292c1..21590ede6 100644
--- a/src/modules/m_sqloper.cpp
+++ b/src/modules/m_sqloper.cpp
@@ -190,7 +190,7 @@ public:
else
SQL.SetProvider("SQL/" + dbid);
- query = tag->getString("query", "SELECT * FROM ircd_opers WHERE active=1;");
+ query = tag->getString("query", "SELECT * FROM ircd_opers WHERE active=1;", 1);
// Update sqloper list from the database.
GetOperBlocks();
}
diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp
index 2b0b333d7..21c83549f 100644
--- a/src/modules/m_xline_db.cpp
+++ b/src/modules/m_xline_db.cpp
@@ -53,7 +53,7 @@ class ModuleXLineDB
* ...and so is discarding all current in-memory XLines for the ones in the database.
*/
ConfigTag* Conf = ServerInstance->Config->ConfValue("xlinedb");
- xlinedbpath = ServerInstance->Config->Paths.PrependData(Conf->getString("filename", "xline.db"));
+ xlinedbpath = ServerInstance->Config->Paths.PrependData(Conf->getString("filename", "xline.db", 1));
SetInterval(Conf->getDuration("saveperiod", 5));
// Read xlines before attaching to events