aboutsummaryrefslogtreecommitdiffstats
path: root/src/users.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-11-24 20:54:33 +0000
committerGravatar Sadie Powell2021-11-24 20:54:33 +0000
commit42b7a77cc621f9363038d98a58ca52c20e0a7d3c (patch)
tree76050d920a95c8c30d0c7a81e99bd60602624991 /src/users.cpp
parentRemove the legacy sendq to hardsendq/softsendq logic. (diff)
Move configuration of connect classes to the ConnectClass class.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 430d5df55..06bd58421 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1257,6 +1257,39 @@ ConnectClass::ConnectClass(std::shared_ptr<ConfigTag> tag, Type t, const std::ve
}
}
+void ConnectClass::Configure(const std::string& classname, std::shared_ptr<ConfigTag> tag)
+{
+ name = classname;
+
+ password = tag->getString("password", password);
+ passwordhash = tag->getString("hash", passwordhash);
+ if (!password.empty() && (passwordhash.empty() || stdalgo::string::equalsci(passwordhash, "plaintext")))
+ {
+ ServerInstance->Logs.Log("CONNECTCLASS", LOG_DEFAULT, "<connect> tag '%s' at %s contains an plain text password, this is insecure!",
+ name.c_str(), tag->source.str().c_str());
+ }
+
+ irc::portparser portrange(tag->getString("port"), false);
+ while (long port = portrange.GetToken())
+ ports.insert(static_cast<int>(port));
+
+ commandrate = tag->getUInt("commandrate", commandrate, 1);
+ fakelag = tag->getBool("fakelag", fakelag);
+ hardsendqmax = tag->getUInt("hardsendq", hardsendqmax, ServerInstance->Config->Limits.MaxLine);
+ limit = tag->getUInt("limit", limit, 1);
+ maxchans = tag->getUInt("maxchans", maxchans);
+ maxconnwarn = tag->getBool("maxconnwarn", maxconnwarn);
+ maxglobal = tag->getUInt("globalmax", maxglobal, 1);
+ maxlocal = tag->getUInt("localmax", maxlocal, 1);
+ penaltythreshold = tag->getUInt("threshold", penaltythreshold, 1);
+ pingtime = tag->getDuration("pingfreq", pingtime);
+ recvqmax = tag->getUInt("recvq", recvqmax, ServerInstance->Config->Limits.MaxLine);
+ registration_timeout = tag->getDuration("timeout", registration_timeout);
+ resolvehostnames = tag->getBool("resolvehostnames", resolvehostnames);
+ softsendqmax = tag->getUInt("softsendq", softsendqmax, ServerInstance->Config->Limits.MaxLine);
+ uniqueusername = tag->getBool("uniqueusername", uniqueusername);
+}
+
void ConnectClass::Update(const std::shared_ptr<ConnectClass> src)
{
commandrate = src->commandrate;