summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/configreader.h6
-rw-r--r--src/configreader.cpp2
-rw-r--r--src/listmode.cpp2
-rw-r--r--src/modules/extra/m_mysql.cpp2
-rw-r--r--src/modules/extra/m_ssl_mbedtls.cpp4
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp4
-rw-r--r--src/modules/m_connflood.cpp8
-rw-r--r--src/modules/m_permchannels.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.cpp11
9 files changed, 19 insertions, 22 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 9349813d6..bb4c03fae 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -45,9 +45,9 @@ class CoreExport ConfigTag : public refcountbase
/** Get the value of an option, using def if it does not exist */
std::string getString(const std::string& key, const std::string& def = "", size_t minlen = 0, size_t maxlen = UINT32_MAX);
/** Get the value of an option, using def if it does not exist */
- long getInt(const std::string& key, long def = 0, long min = LONG_MIN, long max = LONG_MAX);
+ long getInt(const std::string& key, long def, long min = LONG_MIN, long max = LONG_MAX);
/** Get the value of an option, using def if it does not exist */
- double getFloat(const std::string& key, double def = 0);
+ double getFloat(const std::string& key, double def);
/** Get the value of an option, using def if it does not exist */
bool getBool(const std::string& key, bool def = false);
@@ -59,7 +59,7 @@ class CoreExport ConfigTag : public refcountbase
* @param max Maximum acceptable value (optional)
* @return The duration in seconds
*/
- long getDuration(const std::string& key, long def = 0, long min = LONG_MIN, long max = LONG_MAX);
+ long getDuration(const std::string& key, long def, long min = LONG_MIN, long max = LONG_MAX);
/** Get the value of an option
* @param key The option to get
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 58a932981..76bd268f2 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -443,7 +443,7 @@ void ServerConfig::Fill()
DefaultModes = options->getString("defaultmodes", "not");
PID = ConfValue("pid")->getString("file");
MaxChans = ConfValue("channels")->getInt("users", 20);
- OperMaxChans = ConfValue("channels")->getInt("opers");
+ OperMaxChans = ConfValue("channels")->getInt("opers", 0);
c_ipv4_range = ConfValue("cidr")->getInt("ipv4clone", 32, 1, 32);
c_ipv6_range = ConfValue("cidr")->getInt("ipv6clone", 128, 1, 128);
Limits = ServerLimits(ConfValue("limits"));
diff --git a/src/listmode.cpp b/src/listmode.cpp
index a8f6e5108..d106bfa1d 100644
--- a/src/listmode.cpp
+++ b/src/listmode.cpp
@@ -69,7 +69,7 @@ void ListModeBase::DoRehash()
{
// For each <banlist> tag
ConfigTag* c = i->second;
- ListLimit limit(c->getString("chan"), c->getInt("limit"));
+ ListLimit limit(c->getString("chan"), c->getInt("limit", 0));
if (limit.mask.size() && limit.limit > 0)
chanlimits.push_back(limit);
diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp
index a177951ce..6c65cd87e 100644
--- a/src/modules/extra/m_mysql.cpp
+++ b/src/modules/extra/m_mysql.cpp
@@ -272,7 +272,7 @@ class SQLConnection : public SQL::Provider
std::string user = config->getString("user");
std::string pass = config->getString("pass");
std::string dbname = config->getString("name");
- int port = config->getInt("port");
+ int port = config->getInt("port", 3306);
bool rv = mysql_real_connect(connection, host.c_str(), user.c_str(), pass.c_str(), dbname.c_str(), port, NULL, 0);
if (!rv)
return rv;
diff --git a/src/modules/extra/m_ssl_mbedtls.cpp b/src/modules/extra/m_ssl_mbedtls.cpp
index 8c15342f2..391d4d79b 100644
--- a/src/modules/extra/m_ssl_mbedtls.cpp
+++ b/src/modules/extra/m_ssl_mbedtls.cpp
@@ -413,8 +413,8 @@ namespace mbedTLS
, mindh(tag->getInt("mindhbits", 2048))
, hashstr(tag->getString("hash", "sha256"))
, castr(tag->getString("cafile"))
- , minver(tag->getInt("minver"))
- , maxver(tag->getInt("maxver"))
+ , minver(tag->getInt("minver", 0))
+ , maxver(tag->getInt("maxver", 0))
, outrecsize(tag->getInt("outrecsize", 2048, 512, 16384))
, requestclientcert(tag->getBool("requestclientcert", true))
{
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 2129e5da7..828fcc26a 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -334,8 +334,8 @@ namespace OpenSSL
*/
void SetContextOptions(const std::string& ctxname, ConfigTag* tag, Context& context)
{
- long setoptions = tag->getInt(ctxname + "setoptions");
- long clearoptions = tag->getInt(ctxname + "clearoptions");
+ long setoptions = tag->getInt(ctxname + "setoptions", 0);
+ long clearoptions = tag->getInt(ctxname + "clearoptions", 0);
#ifdef SSL_OP_NO_COMPRESSION
if (!tag->getBool("compression", false)) // Disable compression by default
setoptions |= SSL_OP_NO_COMPRESSION;
diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp
index 1d27e3990..29d4d9d3a 100644
--- a/src/modules/m_connflood.cpp
+++ b/src/modules/m_connflood.cpp
@@ -46,13 +46,13 @@ public:
/* read configuration variables */
ConfigTag* tag = ServerInstance->Config->ConfValue("connflood");
/* throttle configuration */
- seconds = tag->getDuration("period", tag->getInt("seconds"));
- maxconns = tag->getInt("maxconns");
- timeout = tag->getDuration("timeout");
+ seconds = tag->getDuration("period", tag->getInt("seconds", 30));
+ maxconns = tag->getInt("maxconns", 3);
+ timeout = tag->getDuration("timeout", 30);
quitmsg = tag->getString("quitmsg");
/* seconds to wait when the server just booted */
- boot_wait = tag->getInt("bootwait");
+ boot_wait = tag->getInt("bootwait", 10);
first = ServerInstance->Time();
}
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index 7e28c5fc6..95f01839e 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -206,7 +206,7 @@ public:
time_t TS = tag->getInt("ts", ServerInstance->Time(), 1);
c = new Channel(channel, TS);
- unsigned int topicset = tag->getInt("topicts");
+ unsigned int topicset = tag->getInt("topicts", 0);
std::string topic = tag->getString("topic");
if ((topicset != 0) || (!topic.empty()))
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 0a96ecfcd..d6f74cc69 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -229,13 +229,10 @@ void SpanningTreeUtilities::ReadConfiguration()
AnnounceTSChange = options->getBool("announcets");
AllowOptCommon = options->getBool("allowmismatch");
quiet_bursts = ServerInstance->Config->ConfValue("performance")->getBool("quietbursts");
- PingWarnTime = options->getDuration("pingwarning");
- PingFreq = options->getDuration("serverpingfreq");
+ PingWarnTime = options->getDuration("pingwarning", 15);
+ PingFreq = options->getDuration("serverpingfreq", 60, 1);
- if (PingFreq == 0)
- PingFreq = 60;
-
- if (PingWarnTime > PingFreq - 1)
+ if (PingWarnTime >= PingFreq)
PingWarnTime = 0;
AutoconnectBlocks.clear();
@@ -253,7 +250,7 @@ void SpanningTreeUtilities::ReadConfiguration()
L->AllowMasks.push_back(s);
L->IPAddr = tag->getString("ipaddr");
- L->Port = tag->getInt("port");
+ L->Port = tag->getInt("port", 0);
L->SendPass = tag->getString("sendpass", tag->getString("password"));
L->RecvPass = tag->getString("recvpass", tag->getString("password"));
L->Fingerprint = tag->getString("fingerprint");