From 1651feb4de99db09cb1e748244ff05a52f20d530 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 4 Sep 2016 18:00:31 +0000 Subject: [PATCH] squash some of my overly verbose commits that have no uses --- CMakeLists.txt | 4 +-- .../src/shared/ConfigLoginServer.cpp | 4 +-- .../LoginServer/src/shared/LoginServer.cpp | 27 ++++++++++++------- .../src/shared/TaskGetClusterList.cpp | 25 +++++------------ .../src/shared/TaskGetClusterList.h | 2 -- .../database/login_packages/login.plsql | 2 +- .../database/login_schema/cluster_list.tab | 1 - game/server/database/updates/79.sql | 1 - 8 files changed, 29 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f6808dd8..98680a83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,11 +67,11 @@ elseif(UNIX) # not sure if needed or not - https://wiki.debian.org/Hardening # ============================================================================================ # -fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fPIE -ftrapv + # -D_FORTIFY_SOURCE=2 is generally considered safe but crashes datatabletool when built with gcc set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -D_GLIBCXX_USE_CXX11_ABI=0 \ -m32 -pipe -march=native -mtune=native \ - -Wformat \ - -Wno-overloaded-virtual -Wno-missing-braces -Wno-format \ + -Wformat -Wno-overloaded-virtual -Wno-missing-braces -Wno-format \ -Wno-write-strings -Wno-unknown-pragmas \ -Wno-uninitialized -Wno-reorder") diff --git a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp index 24367e9f..1e11c8df 100755 --- a/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/ConfigLoginServer.cpp @@ -69,7 +69,7 @@ void ConfigLoginServer::install(void) KEY_INT (centralServicePort, 44452); KEY_INT (clientServicePort, 44453); KEY_INT (clientOverflowLimit, 1024 * 8); - KEY_INT (maxClients, 250); + KEY_INT (maxClients, 3000); KEY_INT (taskServicePort, 44459); KEY_INT (pingServicePort, 44460); KEY_INT (httpServicePort, 44490); @@ -112,7 +112,7 @@ void ConfigLoginServer::install(void) KEY_INT (populationHeavyThresholdPercent, 32); KEY_INT (populationMediumThresholdPercent, 16); KEY_INT (populationLightThresholdPercent, 8); - KEY_INT (csToolPort, 10666); + KEY_INT (csToolPort, 0); // use 10666 if you want to turn the tool on KEY_BOOL(requireSecureLoginForCsTool, true); KEY_BOOL(useExternalAuth, false); KEY_STRING(externalAuthURL, ""); diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index 8393f5a9..2216d3cb 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -160,8 +160,12 @@ LoginServer::LoginServer() : m_centralService = new Service(ConnectionAllocator(), setup); } + // only start the customer tool connection listener if the port is set (defaults to 0) setup.port = ConfigLoginServer::getCSToolPort(); - m_CSService = new Service(ConnectionAllocator(), setup); + if (setup.port) + { + m_CSService = new Service(ConnectionAllocator(), setup); + } // set up message connections connectToMessage("ClaimRewardsMessage"); @@ -387,12 +391,17 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const CentralServerConnection * connection = const_cast(safe_cast(&source)); DEBUG_REPORT_LOG(true, ("Cluster connection %s opened\n", msg.getClusterName().c_str())); ClusterListEntry *cle = nullptr; - if (ConfigLoginServer::getDevelopmentMode()) - { - // in this mode, we trust the name sent by the cluster and we dynamically add clusters we don't know about - cle = findClusterByName(msg.getClusterName()); - if (!cle) - cle = addCluster(msg.getClusterName()); + if (ConfigLoginServer::getDevelopmentMode()) { + // in this mode, we trust the name sent by the cluster + cle = findClusterByName(msg.getClusterName()); +#ifdef _DEBUG + // if in debug mode, we dynamically add clusters we don't know about + // DO NOT USE ON PRODUCTION! This is where other servers are getting hijacked. + if (!cle) + { + cle = addCluster(msg.getClusterName()); + } +#endif } else { @@ -407,7 +416,7 @@ void LoginServer::receiveMessage(const MessageDispatch::Emitter & source, const disconnectCluster(*cle, true, false); cle = nullptr; } - } + } if (cle) { @@ -1961,4 +1970,4 @@ void LoginServer::setClusterInfoByName(const std::string &name, const std::strin } } -// ====================================================================== \ No newline at end of file +// ====================================================================== diff --git a/engine/server/application/LoginServer/src/shared/TaskGetClusterList.cpp b/engine/server/application/LoginServer/src/shared/TaskGetClusterList.cpp index 86d72d26..96bf1c19 100755 --- a/engine/server/application/LoginServer/src/shared/TaskGetClusterList.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskGetClusterList.cpp @@ -38,24 +38,13 @@ bool TaskGetClusterList::process(DB::Session *session) while ((rowsFetched = qry.fetch()) > 0) { - qry.altAddress.getValue(temp.m_address); - - if (temp.m_address.empty()) - { - qry.address.getValue(temp.m_address); - } - - if (qry.port.isNull()) - { - temp.m_port = ConfigLoginServer::getCentralServicePort(); - } - else - { - temp.m_port = static_cast(qry.port.getValue()); - } - qry.cluster_id.getValue(temp.m_clusterId); qry.cluster_name.getValue(temp.m_clusterName); + qry.address.getValue(temp.m_address); + if (qry.port.isNull()) + temp.m_port = ConfigLoginServer::getCentralServicePort(); + else + temp.m_port = static_cast(qry.port.getValue()); qry.secret.getValue(temp.m_secret); qry.locked.getValue(temp.m_locked); qry.not_recommended.getValue(temp.m_notRecommended); @@ -88,7 +77,7 @@ void TaskGetClusterList::onComplete() void TaskGetClusterList::GetClustersQuery::getSQL(std::string &sql) { sql=std::string("begin :result := ")+DatabaseConnection::getInstance().getSchemaQualifier()+"login.get_cluster_list(:group_id); end;"; - DEBUG_REPORT_LOG(true, ("TaskGetClusterList SQL: %s\n", sql.c_str())); + // DEBUG_REPORT_LOG(true, ("TaskGetClusterList SQL: %s\n", sql.c_str())); } @@ -107,7 +96,6 @@ bool TaskGetClusterList::GetClustersQuery::bindColumns() if (!bindCol(cluster_id)) return false; if (!bindCol(cluster_name)) return false; if (!bindCol(address)) return false; - if (!bindCol(altAddress)) return false; if (!bindCol(port)) return false; if (!bindCol(secret)) return false; if (!bindCol(locked)) return false; @@ -136,7 +124,6 @@ TaskGetClusterList::GetClustersQuery::GetClustersQuery() : cluster_id(), cluster_name(), address(), - altAddress(), port(), secret(), locked(), diff --git a/engine/server/application/LoginServer/src/shared/TaskGetClusterList.h b/engine/server/application/LoginServer/src/shared/TaskGetClusterList.h index e57d223c..534c95f1 100755 --- a/engine/server/application/LoginServer/src/shared/TaskGetClusterList.h +++ b/engine/server/application/LoginServer/src/shared/TaskGetClusterList.h @@ -36,7 +36,6 @@ class TaskGetClusterList : public DB::TaskRequest DB::BindableLong cluster_id; //lint !e1925 // public data member DB::BindableString<255> cluster_name; //lint !e1925 // public data member DB::BindableString<255> address; //lint !e1925 // public data member - DB::BindableString<255> altAddress; //lint !e1925 // public data member DB::BindableLong port; //lint !e1925 // public data member DB::BindableBool secret; //lint !e1925 // public data member DB::BindableBool locked; //lint !e1925 // public data member @@ -64,7 +63,6 @@ class TaskGetClusterList : public DB::TaskRequest uint32 m_clusterId; std::string m_clusterName; std::string m_address; - std::string m_altAddress; uint16 m_port; bool m_secret; bool m_locked; diff --git a/game/server/database/login_packages/login.plsql b/game/server/database/login_packages/login.plsql index e74f1b64..02695492 100644 --- a/game/server/database/login_packages/login.plsql +++ b/game/server/database/login_packages/login.plsql @@ -32,7 +32,7 @@ as from default_char_limits; open result_cursor for - select id, name, address, altAddress, port, secret, locked, not_recommended, maxCharacterPerAccount, + select id, name, address, port, secret, locked, not_recommended, maxCharacterPerAccount, online_player_limit,online_free_trial_limit,free_trial_can_create_char,online_tutorial_limit from cluster_list where group_id = p_group; diff --git a/game/server/database/login_schema/cluster_list.tab b/game/server/database/login_schema/cluster_list.tab index cabf6c10..121bcdb8 100644 --- a/game/server/database/login_schema/cluster_list.tab +++ b/game/server/database/login_schema/cluster_list.tab @@ -4,7 +4,6 @@ create table cluster_list --NO_IMPORT name varchar2(255), num_characters number, address varchar2(255), - altAddress varchar2(255), port number default 44463, secret char(1), locked char(1), diff --git a/game/server/database/updates/79.sql b/game/server/database/updates/79.sql index 1868f13b..68c16670 100644 --- a/game/server/database/updates/79.sql +++ b/game/server/database/updates/79.sql @@ -1,5 +1,4 @@ alter table cluster_list add address varchar2(255); -alter table cluster_list add altAddress varchar2(255); alter table cluster_list add port number; alter table cluster_list add secret char(1); update cluster_list set secret='N';