From 1f2a832e3787252230978053985d2b66d60aaead Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 19 Nov 2019 09:24:03 +0100 Subject: [PATCH] update cacert file path, fixtest --- src/cpp/ServerConfig.cpp | 3 ++- src/cpp/SingletonManager/SessionManager.cpp | 3 ++- src/cpp/tasks/CPUSheduler.cpp | 4 +++- src/cpp/test/TestTasks.cpp | 1 + src/cpp/test/main.cpp | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/cpp/ServerConfig.cpp b/src/cpp/ServerConfig.cpp index 26f150d07..b917a39e5 100644 --- a/src/cpp/ServerConfig.cpp +++ b/src/cpp/ServerConfig.cpp @@ -11,6 +11,7 @@ #include "Poco/SharedPtr.h" #include "Poco/Mutex.h" +#include "Poco/Path.h" #include "Poco/FileStream.h" #include "Poco/LocalDateTime.h" #include "Poco/DateTimeFormat.h" @@ -129,7 +130,7 @@ namespace ServerConfig { g_SSL_CLient_Context = new Context(Context::CLIENT_USE, "cacert.pem", Context::VERIFY_RELAXED, Context::OPT_DEFAULTS); #else - g_SSL_CLient_Context = new Context(Context::CLIENT_USE, "", "", "cacert.pem", Context::VERIFY_RELAXED, 9, true, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); + g_SSL_CLient_Context = new Context(Context::CLIENT_USE, "", "", Poco::Path::config() + "grd_login/cacert.pem", Context::VERIFY_RELAXED, 9, true, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); #endif } catch(Poco::Exception& ex) { printf("[ServerConfig::initSSLClientContext] error init ssl context, maybe no cacert.pem found?\nPlease make sure you have cacert.pem (CA/root certificates) next to binary from https://curl.haxx.se/docs/caextract.html\n"); diff --git a/src/cpp/SingletonManager/SessionManager.cpp b/src/cpp/SingletonManager/SessionManager.cpp index e755ebca4..17b7ee5e8 100644 --- a/src/cpp/SingletonManager/SessionManager.cpp +++ b/src/cpp/SingletonManager/SessionManager.cpp @@ -289,7 +289,8 @@ void SessionManager::checkTimeoutSession() mWorkingMutex.lock(); auto now = Poco::DateTime(); // random variance within 10 seconds for timeout to make it harder to get information and hack the server - auto timeout = Poco::Timespan(ServerConfig::g_SessionTimeout * 60, randombytes_random() % 10000000); + //auto timeout = Poco::Timespan(ServerConfig::g_SessionTimeout * 60, randombytes_random() % 10000000); + auto timeout = Poco::Timespan(1, 0); std::stack toRemove; for (auto it = mRequestSessionMap.begin(); it != mRequestSessionMap.end(); it++) { if (!it->second->isActive()) continue; diff --git a/src/cpp/tasks/CPUSheduler.cpp b/src/cpp/tasks/CPUSheduler.cpp index c06814e5b..9f4552ec4 100644 --- a/src/cpp/tasks/CPUSheduler.cpp +++ b/src/cpp/tasks/CPUSheduler.cpp @@ -17,7 +17,9 @@ namespace UniLib { if(len > 7) len = 7; memcpy(nameBuffer, name, len); int i = 0; - ServerConfig::g_ServerKeySeed->put(threadCount, 1726199827); + if (ServerConfig::g_ServerKeySeed) { + ServerConfig::g_ServerKeySeed->put(threadCount, 1726199827); + } for(int i = 0; i < threadCount; i++) { sprintf(&nameBuffer[len], "%.2d", i); mThreads[i] = new CPUShedulerThread(this, nameBuffer); diff --git a/src/cpp/test/TestTasks.cpp b/src/cpp/test/TestTasks.cpp index 9250d7cd5..c7d0f33ab 100644 --- a/src/cpp/test/TestTasks.cpp +++ b/src/cpp/test/TestTasks.cpp @@ -2,6 +2,7 @@ #include "TestTasks.h" #include "Poco/Environment.h" #include +#include #include "Poco/Logger.h" #include "Poco/Path.h" diff --git a/src/cpp/test/main.cpp b/src/cpp/test/main.cpp index b2a4ee04d..a8e3ab6a4 100644 --- a/src/cpp/test/main.cpp +++ b/src/cpp/test/main.cpp @@ -11,6 +11,7 @@ void fillTests() } int load() { + // init server config, init seed array fillTests(); for (std::list::iterator it = gTests.begin(); it != gTests.end(); it++) {