summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2013-07-02 11:10:36 -0700
committerAttila Molnar <attilamolnar@hush.com>2013-07-02 11:10:36 -0700
commit4c12eafe612932f4b3f6806fc1bea79942998941 (patch)
treeed742758f5468a63f434ac5fe1994d35c455a561 /src
parentc286b42418c3d7614225b1226632a25ac513994b (diff)
parent3ae91bafe711b26ffae1aa27cfd4f5fe7bfc2347 (diff)
Merge pull request #571 from ShutterQuick/inspircd+checkclone
Allow for skipping clone checking before DNS is complete.
Diffstat (limited to 'src')
-rw-r--r--src/configreader.cpp1
-rw-r--r--src/usermanager.cpp2
-rw-r--r--src/users.cpp29
3 files changed, 18 insertions, 14 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 427bc79bf..31287b396 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -387,6 +387,7 @@ void ServerConfig::Fill()
SuffixPart = options->getString("suffixpart");
FixedPart = options->getString("fixedpart");
SoftLimit = ConfValue("performance")->getInt("softlimit", ServerInstance->SE->GetMaxFds());
+ CCOnConnect = ConfValue("performance")->getBool("clonesonconnect", true);
MaxConn = ConfValue("performance")->getInt("somaxconn", SOMAXCONN);
MoronBanner = options->getString("moronbanner", "You're banned!");
ServerDesc = ConfValue("server")->getString("description", "Configure Me");
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 8a05c811c..e7d1fd05c 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -112,7 +112,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
* Check connect class settings and initialise settings into User.
* This will be done again after DNS resolution. -- w00t
*/
- New->CheckClass();
+ New->CheckClass(ServerInstance->Config->CCOnConnect);
if (New->quitting)
return;
diff --git a/src/users.cpp b/src/users.cpp
index 468c2aa36..0dc9cea57 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -600,7 +600,7 @@ void User::UnOper()
/*
* Check class restrictions
*/
-void LocalUser::CheckClass()
+void LocalUser::CheckClass(bool clone_count)
{
ConnectClass* a = this->MyClass;
@@ -614,19 +614,22 @@ void LocalUser::CheckClass()
ServerInstance->Users->QuitUser(this, a->config->getString("reason", "Unauthorised connection"));
return;
}
- else if ((a->GetMaxLocal()) && (ServerInstance->Users->LocalCloneCount(this) > a->GetMaxLocal()))
+ else if (clone_count)
{
- ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (local)");
- if (a->maxconnwarn)
- ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString().c_str());
- return;
- }
- else if ((a->GetMaxGlobal()) && (ServerInstance->Users->GlobalCloneCount(this) > a->GetMaxGlobal()))
- {
- ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (global)");
- if (a->maxconnwarn)
- ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s", a->GetMaxGlobal(), this->GetIPString().c_str());
- return;
+ if ((a->GetMaxLocal()) && (ServerInstance->Users->LocalCloneCount(this) > a->GetMaxLocal()))
+ {
+ ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (local)");
+ if (a->maxconnwarn)
+ ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum LOCAL connections (%ld) exceeded for IP %s", a->GetMaxLocal(), this->GetIPString().c_str());
+ return;
+ }
+ else if ((a->GetMaxGlobal()) && (ServerInstance->Users->GlobalCloneCount(this) > a->GetMaxGlobal()))
+ {
+ ServerInstance->Users->QuitUser(this, "No more connections allowed from your host via this connect class (global)");
+ if (a->maxconnwarn)
+ ServerInstance->SNO->WriteToSnoMask('a', "WARNING: maximum GLOBAL connections (%ld) exceeded for IP %s", a->GetMaxGlobal(), this->GetIPString().c_str());
+ return;
+ }
}
this->nping = ServerInstance->Time() + a->GetPingTime() + ServerInstance->Config->dns_timeout;