From 225322b46f888fb034c87aea45fdde3f941c6450 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 12 Jan 2015 14:10:53 +0100 Subject: Fix harmless uninitialized variable usage on startup if the config is incorrect --- src/configreader.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/configreader.cpp') diff --git a/src/configreader.cpp b/src/configreader.cpp index b5d2fdb16..bd147782e 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -35,6 +35,7 @@ #endif ServerConfig::ServerConfig() + : NoSnoticeStack(false) { WhoWasGroupSize = WhoWasMaxGroups = WhoWasMaxKeep = 0; RawLog = NoUserDns = HideBans = HideSplits = UndernetMsgPrefix = false; -- cgit v1.3.1-10-gc9f91 From 2653fbaa28c9b7b41e03abd4893ea623a6276d21 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Mon, 19 Jan 2015 17:38:30 +0100 Subject: Don't bind ports after an unsuccessful rehash --- src/configreader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/configreader.cpp') diff --git a/src/configreader.cpp b/src/configreader.cpp index bd147782e..b3caf8c75 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -730,7 +730,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid) if (valid) ServerInstance->WritePID(this->PID); - if (old) + if (old && valid) { // On first run, ports are bound later on FailedPortList pl; -- cgit v1.3.1-10-gc9f91 From 7f051bcc5198c2eb3fff1ca52888bd7c6ec19000 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 3 Mar 2015 15:45:22 -0500 Subject: Rebuild clone counts on rehash --- include/usermanager.h | 4 ++++ src/configreader.cpp | 1 + src/usermanager.cpp | 16 ++++++++++++++++ 3 files changed, 21 insertions(+) (limited to 'src/configreader.cpp') diff --git a/include/usermanager.h b/include/usermanager.h index ac8ae1cb3..2a9d6b47b 100644 --- a/include/usermanager.h +++ b/include/usermanager.h @@ -112,6 +112,10 @@ class CoreExport UserManager */ void RemoveCloneCounts(User *user); + /** Rebuild clone counts + */ + void RehashCloneCounts(); + /** Return the number of global clones of this user * @param user The user to get a count for * @return The global clone count of this user diff --git a/src/configreader.cpp b/src/configreader.cpp index b3caf8c75..bcee938d5 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -963,6 +963,7 @@ void ConfigReaderThread::Finish() * XXX: The order of these is IMPORTANT, do not reorder them without testing * thoroughly!!! */ + ServerInstance->Users->RehashCloneCounts(); ServerInstance->XLines->CheckELines(); ServerInstance->XLines->ApplyLines(); ServerInstance->Res->Rehash(); diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 1918b5c4c..76446c5b5 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -287,6 +287,22 @@ void UserManager::RemoveCloneCounts(User *user) } } +void UserManager::RehashCloneCounts() +{ + local_clones.clear(); + global_clones.clear(); + + const user_hash& hash = *ServerInstance->Users->clientlist; + for (user_hash::const_iterator i = hash.begin(); i != hash.end(); ++i) + { + User* u = i->second; + + if (IS_LOCAL(u)) + AddLocalClone(u); + AddGlobalClone(u); + } +} + unsigned long UserManager::GlobalCloneCount(User *user) { clonemap::iterator x = global_clones.find(user->GetCIDRMask()); -- cgit v1.3.1-10-gc9f91