diff options
author | Shauren <shauren.trinity@gmail.com> | 2017-10-03 18:03:57 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2017-10-03 18:03:57 +0200 |
commit | 4d5eacd3af8406e41f6f335355b1f860f2323ee1 (patch) | |
tree | 72bf785977783898fa1fd5a22926ce9e9634f3df | |
parent | 0b36d80115000ab9d1005e5999aad0c3acd9e041 (diff) |
Core/Bnet: Added support for -launcherlogin logins (external client launcher required)
-rw-r--r-- | src/server/bnetserver/REST/LoginRESTService.cpp | 228 | ||||
-rw-r--r-- | src/server/bnetserver/REST/LoginRESTService.h | 26 | ||||
-rw-r--r-- | src/server/bnetserver/Server/Session.cpp | 5 | ||||
-rw-r--r-- | src/server/bnetserver/bnetserver.conf.dist | 5 | ||||
-rw-r--r-- | src/server/database/Database/Implementation/LoginDatabase.cpp | 5 | ||||
-rw-r--r-- | src/server/database/Database/Implementation/LoginDatabase.h | 3 | ||||
-rw-r--r-- | src/server/proto/Login/Login.pb.cc | 466 | ||||
-rw-r--r-- | src/server/proto/Login/Login.pb.h | 673 | ||||
-rw-r--r-- | src/server/proto/Login/Login.proto | 21 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_battlenet_account.cpp | 2 | ||||
-rw-r--r-- | src/tools/connection_patcher/Patches/Common.hpp | 5 | ||||
-rw-r--r-- | src/tools/connection_patcher/Patterns/Common.hpp | 5 | ||||
-rw-r--r-- | src/tools/connection_patcher/Program.cpp | 4 |
13 files changed, 1364 insertions, 84 deletions
diff --git a/src/server/bnetserver/REST/LoginRESTService.cpp b/src/server/bnetserver/REST/LoginRESTService.cpp index 9fd4b246df7..06115a7dc29 100644 --- a/src/server/bnetserver/REST/LoginRESTService.cpp +++ b/src/server/bnetserver/REST/LoginRESTService.cpp @@ -32,16 +32,15 @@ int ns1__executeCommand(soap*, char*, char**) { return SOAP_OK; } -class AsyncLoginRequest +class AsyncRequest { public: - AsyncLoginRequest(std::shared_ptr<soap> client) - : _client(std::move(client)) { } + AsyncRequest(soap const& server) : _client(server) { } - AsyncLoginRequest(AsyncLoginRequest const&) = delete; - AsyncLoginRequest& operator=(AsyncLoginRequest const&) = delete; - AsyncLoginRequest(AsyncLoginRequest&&) = default; - AsyncLoginRequest& operator=(AsyncLoginRequest&&) = default; + AsyncRequest(AsyncRequest const&) = delete; + AsyncRequest& operator=(AsyncRequest const&) = delete; + AsyncRequest(AsyncRequest&&) = default; + AsyncRequest& operator=(AsyncRequest&&) = default; bool InvokeIfReady() { @@ -49,22 +48,25 @@ public: return _callback->InvokeIfReady() == QueryCallback::Completed; } - soap* GetClient() const { return _client.get(); } + soap* GetClient() { return &_client; } void SetCallback(std::unique_ptr<QueryCallback> callback) { _callback = std::move(callback); } + int32 GetResponseStatus() const { return _responseStatus; } + void SetResponseStatus(int32 responseStatus) { _responseStatus = responseStatus; } private: - std::shared_ptr<soap> _client; + soap _client; std::unique_ptr<QueryCallback> _callback; + int32 _responseStatus; }; int32 handle_get_plugin(soap* soapClient) { - return sLoginService.HandleGet(soapClient); + return sLoginService.HandleHttpRequest(soapClient, "GET", sLoginService._getHandlers); } int32 handle_post_plugin(soap* soapClient) { - return sLoginService.HandlePost(soapClient); + return sLoginService.HandleHttpRequest(soapClient, "POST", sLoginService._postHandlers); } bool LoginRESTService::Start(boost::asio::io_service* ioService) @@ -124,6 +126,8 @@ bool LoginRESTService::Start(boost::asio::io_service* ioService) input->set_type("submit"); input->set_label("Log In"); + _loginTicketDuration = sConfigMgr->GetIntDefault("LoginREST.TicketDuration", 3600); + _thread = std::thread(std::bind(&LoginRESTService::Run, this)); return true; } @@ -171,9 +175,17 @@ void LoginRESTService::Run() { nullptr, nullptr } }; + _getHandlers["/bnetserver/login/"] = &LoginRESTService::HandleGetForm; + _getHandlers["/bnetserver/gameAccounts/"] = &LoginRESTService::HandleGetGameAccounts; + _getHandlers["/bnetserver/portal/"] = &LoginRESTService::HandleGetPortal; + + _postHandlers["/bnetserver/login/"] = &LoginRESTService::HandlePostLogin; + _postHandlers["/bnetserver/refreshLoginTicket/"] = &LoginRESTService::HandlePostRefreshLoginTicket; + soap_register_plugin_arg(&soapServer, &http_get, (void*)&handle_get_plugin); soap_register_plugin_arg(&soapServer, &http_post, handlers); soap_register_plugin_arg(&soapServer, &ContentTypePlugin::Init, (void*)"application/json;charset=utf-8"); + soap_register_plugin_arg(&soapServer, &ResponseCodePlugin::Init, nullptr); // Use our already ready ssl context soapServer.ctx = Battlenet::SslContext::instance().native_handle(); @@ -184,21 +196,20 @@ void LoginRESTService::Run() if (!soap_valid_socket(soap_accept(&soapServer))) continue; // ran into an accept timeout - std::shared_ptr<soap> soapClient = std::make_shared<soap>(soapServer); - boost::asio::ip::address_v4 address(soapClient->ip); - if (soap_ssl_accept(soapClient.get()) != SOAP_OK) + std::shared_ptr<AsyncRequest> soapClient = std::make_shared<AsyncRequest>(soapServer); + if (soap_ssl_accept(soapClient->GetClient()) != SOAP_OK) { - TC_LOG_DEBUG("server.rest", "Failed SSL handshake from IP=%s", address.to_string().c_str()); + TC_LOG_DEBUG("server.rest", "Failed SSL handshake from IP=%s", boost::asio::ip::address_v4(soapClient->GetClient()->ip).to_string().c_str()); continue; } - TC_LOG_DEBUG("server.rest", "Accepted connection from IP=%s", address.to_string().c_str()); + TC_LOG_DEBUG("server.rest", "Accepted connection from IP=%s", boost::asio::ip::address_v4(soapClient->GetClient()->ip).to_string().c_str()); _ioService->post([soapClient]() { - soapClient->user = (void*)&soapClient; // this allows us to make a copy of pointer inside GET/POST handlers to increment reference count - soap_begin(soapClient.get()); - soap_begin_recv(soapClient.get()); + soapClient->GetClient()->user = (void*)&soapClient; // this allows us to make a copy of pointer inside GET/POST handlers to increment reference count + soap_begin(soapClient->GetClient()); + soap_begin_recv(soapClient->GetClient()); }); } @@ -208,51 +219,113 @@ void LoginRESTService::Run() TC_LOG_INFO("server.rest", "Login service exiting..."); } -int32 LoginRESTService::HandleGet(soap* soapClient) +int32 LoginRESTService::HandleHttpRequest(soap* soapClient, char const* method, HttpMethodHandlerMap const& handlers) { - boost::asio::ip::address_v4 address(soapClient->ip); - std::string ip_address = address.to_string(); + TC_LOG_DEBUG("server.rest", "[%s:%d] Handling %s request path=\"%s\"", + boost::asio::ip::address_v4(soapClient->ip).to_string().c_str(), soapClient->port, method, soapClient->path); + + size_t pathLength = strlen(soapClient->path); + if (char const* queryPart = strchr(soapClient->path, '?')) + pathLength = queryPart - soapClient->path; - TC_LOG_DEBUG("server.rest", "[%s:%d] Handling GET request path=\"%s\"", ip_address.c_str(), soapClient->port, soapClient->path); + auto handler = handlers.find(std::string{ soapClient->path, pathLength }); + if (handler != handlers.end()) + { + int32 status = (this->*handler->second)(*reinterpret_cast<std::shared_ptr<AsyncRequest>*>(soapClient->user)); + if (status != SOAP_OK) + { + ResponseCodePlugin::GetForClient(soapClient)->ErrorCode = status; + return SendResponse(soapClient, Battlenet::JSON::Login::ErrorResponse()); + } - static std::string const expectedPath = "/bnetserver/login/"; - if (strstr(soapClient->path, expectedPath.c_str()) != &soapClient->path[0]) - return 404; + return SOAP_OK; + } - return SendResponse(soapClient, _formInputs); + ResponseCodePlugin::GetForClient(soapClient)->ErrorCode = 404; + return SendResponse(soapClient, Battlenet::JSON::Login::ErrorResponse()); } -int32 LoginRESTService::HandlePost(soap* soapClient) +int32 LoginRESTService::HandleGetForm(std::shared_ptr<AsyncRequest> request) { - boost::asio::ip::address_v4 address(soapClient->ip); - std::string ip_address = address.to_string(); + return SendResponse(request->GetClient(), _formInputs); +} - TC_LOG_DEBUG("server.rest", "[%s:%d] Handling POST request path=\"%s\"", ip_address.c_str(), soapClient->port, soapClient->path); +int32 LoginRESTService::HandleGetGameAccounts(std::shared_ptr<AsyncRequest> request) +{ + if (!request->GetClient()->userid) + return 401; + + request->SetCallback(Trinity::make_unique<QueryCallback>(LoginDatabase.AsyncQuery([&] { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_GAME_ACCOUNT_LIST); + stmt->setString(0, request->GetClient()->userid); + return stmt; + }()) + .WithPreparedCallback([this, request](PreparedQueryResult result) + { + Battlenet::JSON::Login::GameAccountList response; + if (result) + { + auto formatDisplayName = [](char const* name) -> std::string + { + if (char const* hashPos = strchr(name, '#')) + return std::string("WoW") + ++hashPos; + else + return name; + }; + + time_t now = time(nullptr); + do + { + Field* fields = result->Fetch(); + Battlenet::JSON::Login::GameAccountInfo* gameAccount = response.add_game_accounts(); + gameAccount->set_display_name(formatDisplayName(fields[0].GetCString())); + gameAccount->set_expansion(fields[1].GetUInt8()); + if (!fields[2].IsNull()) + { + uint32 banDate = fields[2].GetUInt32(); + uint32 unbanDate = fields[3].GetUInt32(); + gameAccount->set_is_suspended(unbanDate > now); + gameAccount->set_is_banned(banDate == unbanDate); + gameAccount->set_suspension_reason(fields[4].GetString()); + gameAccount->set_suspension_expires(unbanDate); + } + } while (result->NextRow()); + } + + SendResponse(request->GetClient(), response); + }))); + + _ioService->post([this, request]() { HandleAsyncRequest(request); }); + + return SOAP_OK; +} - static std::string const expectedPath = "/bnetserver/login/"; - if (strstr(soapClient->path, expectedPath.c_str()) != &soapClient->path[0]) - return 404; +int32 LoginRESTService::HandleGetPortal(std::shared_ptr<AsyncRequest> request) +{ + boost::asio::ip::tcp::endpoint const& endpoint = GetAddressForClient(boost::asio::ip::address_v4(request->GetClient()->ip)); + std::string response = Trinity::StringFormat("%s:%d", endpoint.address().to_string().c_str(), sConfigMgr->GetIntDefault("BattlenetPort", 1119)); + soap_response(request->GetClient(), SOAP_FILE); + soap_send_raw(request->GetClient(), response.c_str(), response.length()); + return soap_end_send(request->GetClient()); +} + +int32 LoginRESTService::HandlePostLogin(std::shared_ptr<AsyncRequest> request) +{ char *buf; size_t len; - soap_http_body(soapClient, &buf, &len); + soap_http_body(request->GetClient(), &buf, &len); Battlenet::JSON::Login::LoginForm loginForm; if (!JSON::Deserialize(buf, &loginForm)) { - if (soap_register_plugin_arg(soapClient, &ResponseCodePlugin::Init, nullptr) != SOAP_OK) - return 500; - - ResponseCodePlugin* responseCode = reinterpret_cast<ResponseCodePlugin*>(soap_lookup_plugin(soapClient, ResponseCodePlugin::PluginId)); - ASSERT(responseCode); - - responseCode->ErrorCode = 400; + ResponseCodePlugin::GetForClient(request->GetClient())->ErrorCode = 400; Battlenet::JSON::Login::LoginResult loginResult; loginResult.set_authentication_state(Battlenet::JSON::Login::LOGIN); loginResult.set_error_code("UNABLE_TO_DECODE"); loginResult.set_error_message("There was an internal error while connecting to Battle.net. Please try again later."); - return SendResponse(soapClient, loginResult); + return SendResponse(request->GetClient(), loginResult); } std::string login; @@ -274,7 +347,6 @@ int32 LoginRESTService::HandlePost(soap* soapClient) std::string sentPasswordHash = CalculateShaPassHash(login, password); - std::shared_ptr<AsyncLoginRequest> request = std::make_shared<AsyncLoginRequest>(*reinterpret_cast<std::shared_ptr<soap>*>(soapClient->user)); request->SetCallback(Trinity::make_unique<QueryCallback>(LoginDatabase.AsyncQuery(stmt) .WithChainingPreparedCallback([request, login, sentPasswordHash, this](QueryCallback& callback, PreparedQueryResult result) { @@ -300,7 +372,7 @@ int32 LoginRESTService::HandlePost(soap* soapClient) PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_AUTHENTICATION); stmt->setString(0, loginTicket); - stmt->setUInt32(1, time(nullptr) + 3600); + stmt->setUInt32(1, time(nullptr) + _loginTicketDuration); stmt->setUInt32(2, accountId); callback.WithPreparedCallback([request, loginTicket](PreparedQueryResult) { @@ -358,12 +430,53 @@ int32 LoginRESTService::HandlePost(soap* soapClient) } } } + Battlenet::JSON::Login::LoginResult loginResult; loginResult.set_authentication_state(Battlenet::JSON::Login::DONE); sLoginService.SendResponse(request->GetClient(), loginResult); }))); - _ioService->post(std::bind(&LoginRESTService::HandleAsyncRequest, this, std::move(request))); + _ioService->post([this, request]() { HandleAsyncRequest(request); }); + + return SOAP_OK; +} + +int32 LoginRESTService::HandlePostRefreshLoginTicket(std::shared_ptr<AsyncRequest> request) +{ + if (!request->GetClient()->userid) + return 401; + + request->SetCallback(Trinity::make_unique<QueryCallback>(LoginDatabase.AsyncQuery([&] { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_EXISTING_AUTHENTICATION); + stmt->setString(0, request->GetClient()->userid); + return stmt; + }()) + .WithPreparedCallback([this, request](PreparedQueryResult result) + { + Battlenet::JSON::Login::LoginRefreshResult loginRefreshResult; + if (result) + { + uint32 loginTicketExpiry = (*result)[0].GetUInt32(); + time_t now = time(nullptr); + if (loginTicketExpiry > now) + { + loginRefreshResult.set_login_ticket_expiry(now + _loginTicketDuration); + + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_EXISTING_AUTHENTICATION); + stmt->setUInt32(0, uint32(now + _loginTicketDuration)); + stmt->setString(1, request->GetClient()->userid); + LoginDatabase.Execute(stmt); + } + else + loginRefreshResult.set_is_expired(true); + } + else + loginRefreshResult.set_is_expired(true); + + SendResponse(request->GetClient(), loginRefreshResult); + }))); + + _ioService->post([this, request]() { HandleAsyncRequest(request); }); return SOAP_OK; } @@ -377,10 +490,17 @@ int32 LoginRESTService::SendResponse(soap* soapClient, google::protobuf::Message return soap_end_send(soapClient); } -void LoginRESTService::HandleAsyncRequest(std::shared_ptr<AsyncLoginRequest> request) +void LoginRESTService::HandleAsyncRequest(std::shared_ptr<AsyncRequest> request) { if (!request->InvokeIfReady()) - _ioService->post(std::bind(&LoginRESTService::HandleAsyncRequest, this, std::move(request))); + { + _ioService->post([this, request]() { HandleAsyncRequest(request); }); + } + else if (request->GetResponseStatus()) + { + ResponseCodePlugin::GetForClient(request->GetClient())->ErrorCode = request->GetResponseStatus(); + SendResponse(request->GetClient(), Battlenet::JSON::Login::ErrorResponse()); + } } std::string LoginRESTService::CalculateShaPassHash(std::string const& name, std::string const& password) @@ -417,6 +537,7 @@ int32 LoginRESTService::ResponseCodePlugin::Init(soap* s, soap_plugin* p, void* data->fresponse = s->fresponse; p->id = PluginId; + p->fcopy = &Copy; p->fdelete = &Destroy; p->data = data; @@ -424,6 +545,12 @@ int32 LoginRESTService::ResponseCodePlugin::Init(soap* s, soap_plugin* p, void* return SOAP_OK; } +int32 LoginRESTService::ResponseCodePlugin::Copy(soap* s, soap_plugin* dst, soap_plugin* src) +{ + dst->data = new ResponseCodePlugin(*reinterpret_cast<ResponseCodePlugin*>(src->data)); + return SOAP_OK; +} + void LoginRESTService::ResponseCodePlugin::Destroy(soap* s, soap_plugin* p) { ResponseCodePlugin* data = reinterpret_cast<ResponseCodePlugin*>(p->data); @@ -437,6 +564,11 @@ int32 LoginRESTService::ResponseCodePlugin::ChangeResponse(soap* s, int32 origin return self->fresponse(s, self->ErrorCode && originalResponse == SOAP_FILE ? self->ErrorCode : originalResponse, contentLength); } +LoginRESTService::ResponseCodePlugin* LoginRESTService::ResponseCodePlugin::GetForClient(soap* s) +{ + return ASSERT_NOTNULL(reinterpret_cast<ResponseCodePlugin*>(soap_lookup_plugin(s, PluginId))); +} + char const* const LoginRESTService::ContentTypePlugin::PluginId = "bnet-content-type"; int32 LoginRESTService::ContentTypePlugin::Init(soap* s, soap_plugin* p, void* arg) diff --git a/src/server/bnetserver/REST/LoginRESTService.h b/src/server/bnetserver/REST/LoginRESTService.h index e3a74d92907..8d9011dc3d2 100644 --- a/src/server/bnetserver/REST/LoginRESTService.h +++ b/src/server/bnetserver/REST/LoginRESTService.h @@ -19,15 +19,15 @@ #define LoginRESTService_h__ #include "Define.h" -#include "Session.h" #include "Login.pb.h" +#include "Session.h" #include <boost/asio/io_service.hpp> #include <boost/asio/ip/tcp.hpp> #include <boost/asio/ip/address.hpp> #include <atomic> #include <thread> -class AsyncLoginRequest; +class AsyncRequest; struct soap; struct soap_plugin; @@ -53,14 +53,21 @@ private: void Run(); friend int32 handle_get_plugin(soap* soapClient); - int32 HandleGet(soap* soapClient); - friend int32 handle_post_plugin(soap* soapClient); - int32 HandlePost(soap* soapClient); + + using HttpMethodHandlerMap = std::unordered_map<std::string, int32(LoginRESTService::*)(std::shared_ptr<AsyncRequest>)>; + int32 HandleHttpRequest(soap* soapClient, char const* method, HttpMethodHandlerMap const& handlers); + + int32 HandleGetForm(std::shared_ptr<AsyncRequest> request); + int32 HandleGetGameAccounts(std::shared_ptr<AsyncRequest> request); + int32 HandleGetPortal(std::shared_ptr<AsyncRequest> request); + + int32 HandlePostLogin(std::shared_ptr<AsyncRequest> request); + int32 HandlePostRefreshLoginTicket(std::shared_ptr<AsyncRequest> request); int32 SendResponse(soap* soapClient, google::protobuf::Message const& response); - void HandleAsyncRequest(std::shared_ptr<AsyncLoginRequest> request); + void HandleAsyncRequest(std::shared_ptr<AsyncRequest> request); std::string CalculateShaPassHash(std::string const& name, std::string const& password); @@ -68,9 +75,12 @@ private: { static char const* const PluginId; static int32 Init(soap* s, soap_plugin*, void*); + static int32 Copy(soap* s, soap_plugin* dst, soap_plugin* src); static void Destroy(soap* s, soap_plugin* p); static int32 ChangeResponse(soap* s, int32 originalResponse, size_t contentLength); + static ResponseCodePlugin* GetForClient(soap* s); + int32(*fresponse)(soap* s, int32 status, size_t length); int32 ErrorCode; }; @@ -94,6 +104,10 @@ private: int32 _port; boost::asio::ip::tcp::endpoint _externalAddress; boost::asio::ip::tcp::endpoint _localAddress; + uint32 _loginTicketDuration; + + HttpMethodHandlerMap _getHandlers; + HttpMethodHandlerMap _postHandlers; }; #define sLoginService LoginRESTService::Instance() diff --git a/src/server/bnetserver/Server/Session.cpp b/src/server/bnetserver/Server/Session.cpp index c0e2ab9db70..41cd43500d3 100644 --- a/src/server/bnetserver/Server/Session.cpp +++ b/src/server/bnetserver/Server/Session.cpp @@ -206,7 +206,7 @@ void Battlenet::Session::SendRequest(uint32 serviceHash, uint32 methodId, pb::Me AsyncWrite(&packet); } -uint32 Battlenet::Session::HandleLogon(authentication::v1::LogonRequest const* logonRequest, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& /*continuation*/) +uint32 Battlenet::Session::HandleLogon(authentication::v1::LogonRequest const* logonRequest, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) { if (logonRequest->program() != "WoW") { @@ -230,6 +230,9 @@ uint32 Battlenet::Session::HandleLogon(authentication::v1::LogonRequest const* l _os = logonRequest->platform(); _build = logonRequest->application_version(); + if (logonRequest->has_cached_web_credentials()) + return VerifyWebCredentials(logonRequest->cached_web_credentials(), continuation); + boost::asio::ip::tcp::endpoint const& endpoint = sLoginService.GetAddressForClient(GetRemoteIpAddress()); challenge::v1::ChallengeExternalRequest externalChallenge; diff --git a/src/server/bnetserver/bnetserver.conf.dist b/src/server/bnetserver/bnetserver.conf.dist index 9673dfc1c27..79691164cac 100644 --- a/src/server/bnetserver/bnetserver.conf.dist +++ b/src/server/bnetserver/bnetserver.conf.dist @@ -68,10 +68,15 @@ BattlenetPort = 1119 # Set it to your local IP address (common 192.168.x.x network) # or leave it at default value 127.0.0.1 if connecting directly to the internet without a router # +# LoginREST.TicketDuration +# Description: Determines how long the login ticket is valid (in seconds) +# When using client -launcherlogin feature it is recommended to set it to a high value (like a week) +# LoginREST.Port = 8081 LoginREST.ExternalAddress=127.0.0.1 LoginREST.LocalAddress=127.0.0.1 +LoginREST.TicketDuration=3600 # # diff --git a/src/server/database/Database/Implementation/LoginDatabase.cpp b/src/server/database/Database/Implementation/LoginDatabase.cpp index dba35a7c906..23f3d58b936 100644 --- a/src/server/database/Database/Implementation/LoginDatabase.cpp +++ b/src/server/database/Database/Implementation/LoginDatabase.cpp @@ -121,6 +121,8 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_SEL_BNET_AUTHENTICATION, "SELECT ba.id, ba.sha_pass_hash, ba.failed_logins, ba.LoginTicket, ba.LoginTicketExpiry, bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id WHERE email = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_BNET_AUTHENTICATION, "UPDATE battlenet_accounts SET LoginTicket = ?, LoginTicketExpiry = ? WHERE id = ?", CONNECTION_ASYNC); + PrepareStatement(LOGIN_SEL_BNET_EXISTING_AUTHENTICATION, "SELECT LoginTicketExpiry FROM battlenet_accounts WHERE LoginTicket = ?", CONNECTION_ASYNC); + PrepareStatement(LOGIN_UPD_BNET_EXISTING_AUTHENTICATION, "UPDATE battlenet_accounts SET LoginTicketExpiry = ? WHERE LoginTicket = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_SEL_BNET_ACCOUNT_INFO, "SELECT " BnetAccountInfo ", " BnetGameAccountInfo "" " FROM battlenet_accounts ba LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account a ON ba.id = a.battlenet_account" " LEFT JOIN account_banned ab ON a.id = ab.id AND ab.active = 1 LEFT JOIN account_access aa ON a.id = aa.id AND aa.RealmID = -1 WHERE ba.LoginTicket = ? ORDER BY a.id", CONNECTION_ASYNC); @@ -141,7 +143,8 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_SEL_BNET_ACCOUNT_ID_BY_GAME_ACCOUNT, "SELECT battlenet_account FROM account WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_UPD_BNET_GAME_ACCOUNT_LINK, "UPDATE account SET battlenet_account = ?, battlenet_index = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_SEL_BNET_MAX_ACCOUNT_INDEX, "SELECT MAX(battlenet_index) FROM account WHERE battlenet_account = ?", CONNECTION_SYNCH); - PrepareStatement(LOGIN_SEL_BNET_GAME_ACCOUNT_LIST, "SELECT a.id, a.username FROM account a LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id WHERE ba.email = ?", CONNECTION_SYNCH); + PrepareStatement(LOGIN_SEL_BNET_GAME_ACCOUNT_LIST_SMALL, "SELECT a.id, a.username FROM account a LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id WHERE ba.email = ?", CONNECTION_SYNCH); + PrepareStatement(LOGIN_SEL_BNET_GAME_ACCOUNT_LIST, "SELECT a.username, a.expansion, ab.bandate, ab.unbandate, ab.banreason FROM account AS a LEFT JOIN account_banned AS ab ON a.id = ab.id AND ab.active = 1 INNER JOIN battlenet_accounts AS ba ON a.battlenet_account = ba.id WHERE ba.LoginTicket = ? ORDER BY a.id", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_BNET_FAILED_LOGINS, "UPDATE battlenet_accounts SET failed_logins = failed_logins + 1 WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_INS_BNET_ACCOUNT_AUTO_BANNED, "INSERT INTO battlenet_account_bans(id, bandate, unbandate, bannedby, banreason) VALUES(?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()+?, 'Trinity Auth', 'Failed login autoban')", CONNECTION_ASYNC); diff --git a/src/server/database/Database/Implementation/LoginDatabase.h b/src/server/database/Database/Implementation/LoginDatabase.h index dae89a9fb3a..4bca9e3a2fa 100644 --- a/src/server/database/Database/Implementation/LoginDatabase.h +++ b/src/server/database/Database/Implementation/LoginDatabase.h @@ -112,6 +112,8 @@ enum LoginDatabaseStatements : uint32 LOGIN_SEL_BNET_AUTHENTICATION, LOGIN_UPD_BNET_AUTHENTICATION, + LOGIN_SEL_BNET_EXISTING_AUTHENTICATION, + LOGIN_UPD_BNET_EXISTING_AUTHENTICATION, LOGIN_SEL_BNET_ACCOUNT_INFO, LOGIN_UPD_BNET_LAST_LOGIN_INFO, LOGIN_UPD_BNET_GAME_ACCOUNT_LOGIN_INFO, @@ -130,6 +132,7 @@ enum LoginDatabaseStatements : uint32 LOGIN_SEL_BNET_ACCOUNT_ID_BY_GAME_ACCOUNT, LOGIN_UPD_BNET_GAME_ACCOUNT_LINK, LOGIN_SEL_BNET_MAX_ACCOUNT_INDEX, + LOGIN_SEL_BNET_GAME_ACCOUNT_LIST_SMALL, LOGIN_SEL_BNET_GAME_ACCOUNT_LIST, LOGIN_UPD_BNET_FAILED_LOGINS, diff --git a/src/server/proto/Login/Login.pb.cc b/src/server/proto/Login/Login.pb.cc index 7e1cd22b1ec..926040fae90 100644 --- a/src/server/proto/Login/Login.pb.cc +++ b/src/server/proto/Login/Login.pb.cc @@ -18,17 +18,15 @@ #include "Log.h" // @@protoc_insertion_point(includes) -// Fix stupid windows.h included from Log.h->Common.h -#ifdef SendMessage -#undef SendMessage -#endif - namespace Battlenet { namespace JSON { namespace Login { namespace { +const ::google::protobuf::Descriptor* ErrorResponse_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + ErrorResponse_reflection_ = NULL; const ::google::protobuf::Descriptor* FormInput_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* FormInput_reflection_ = NULL; @@ -44,6 +42,15 @@ const ::google::protobuf::internal::GeneratedMessageReflection* const ::google::protobuf::Descriptor* LoginResult_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* LoginResult_reflection_ = NULL; +const ::google::protobuf::Descriptor* LoginRefreshResult_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + LoginRefreshResult_reflection_ = NULL; +const ::google::protobuf::Descriptor* GameAccountInfo_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + GameAccountInfo_reflection_ = NULL; +const ::google::protobuf::Descriptor* GameAccountList_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + GameAccountList_reflection_ = NULL; const ::google::protobuf::EnumDescriptor* FormType_descriptor_ = NULL; const ::google::protobuf::EnumDescriptor* AuthenticationState_descriptor_ = NULL; @@ -56,7 +63,21 @@ void protobuf_AssignDesc_Login_2eproto() { ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName( "Login.proto"); GOOGLE_CHECK(file != NULL); - FormInput_descriptor_ = file->message_type(0); + ErrorResponse_descriptor_ = file->message_type(0); + static const int ErrorResponse_offsets_[1] = { + }; + ErrorResponse_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + ErrorResponse_descriptor_, + ErrorResponse::default_instance_, + ErrorResponse_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ErrorResponse, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(ErrorResponse)); + FormInput_descriptor_ = file->message_type(1); static const int FormInput_offsets_[4] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormInput, input_id_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormInput, type_), @@ -74,7 +95,7 @@ void protobuf_AssignDesc_Login_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(FormInput)); - FormInputs_descriptor_ = file->message_type(1); + FormInputs_descriptor_ = file->message_type(2); static const int FormInputs_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormInputs, type_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormInputs, inputs_), @@ -90,7 +111,7 @@ void protobuf_AssignDesc_Login_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(FormInputs)); - FormInputValue_descriptor_ = file->message_type(2); + FormInputValue_descriptor_ = file->message_type(3); static const int FormInputValue_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormInputValue, input_id_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormInputValue, value_), @@ -106,7 +127,7 @@ void protobuf_AssignDesc_Login_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(FormInputValue)); - LoginForm_descriptor_ = file->message_type(3); + LoginForm_descriptor_ = file->message_type(4); static const int LoginForm_offsets_[4] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginForm, platform_id_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginForm, program_id_), @@ -124,7 +145,7 @@ void protobuf_AssignDesc_Login_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(LoginForm)); - LoginResult_descriptor_ = file->message_type(4); + LoginResult_descriptor_ = file->message_type(5); static const int LoginResult_offsets_[5] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginResult, authentication_state_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginResult, error_code_), @@ -143,6 +164,57 @@ void protobuf_AssignDesc_Login_2eproto() { ::google::protobuf::DescriptorPool::generated_pool(), ::google::protobuf::MessageFactory::generated_factory(), sizeof(LoginResult)); + LoginRefreshResult_descriptor_ = file->message_type(6); + static const int LoginRefreshResult_offsets_[2] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginRefreshResult, login_ticket_expiry_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginRefreshResult, is_expired_), + }; + LoginRefreshResult_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + LoginRefreshResult_descriptor_, + LoginRefreshResult::default_instance_, + LoginRefreshResult_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginRefreshResult, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(LoginRefreshResult, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(LoginRefreshResult)); + GameAccountInfo_descriptor_ = file->message_type(7); + static const int GameAccountInfo_offsets_[6] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountInfo, display_name_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountInfo, expansion_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountInfo, is_suspended_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountInfo, is_banned_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountInfo, suspension_expires_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountInfo, suspension_reason_), + }; + GameAccountInfo_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + GameAccountInfo_descriptor_, + GameAccountInfo::default_instance_, + GameAccountInfo_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountInfo, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountInfo, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(GameAccountInfo)); + GameAccountList_descriptor_ = file->message_type(8); + static const int GameAccountList_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountList, game_accounts_), + }; + GameAccountList_reflection_ = + new ::google::protobuf::internal::GeneratedMessageReflection( + GameAccountList_descriptor_, + GameAccountList::default_instance_, + GameAccountList_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountList, _has_bits_[0]), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GameAccountList, _unknown_fields_), + -1, + ::google::protobuf::DescriptorPool::generated_pool(), + ::google::protobuf::MessageFactory::generated_factory(), + sizeof(GameAccountList)); FormType_descriptor_ = file->enum_type(0); AuthenticationState_descriptor_ = file->enum_type(1); } @@ -158,6 +230,8 @@ inline void protobuf_AssignDescriptorsOnce() { void protobuf_RegisterTypes(const ::std::string&) { protobuf_AssignDescriptorsOnce(); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + ErrorResponse_descriptor_, &ErrorResponse::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( FormInput_descriptor_, &FormInput::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( FormInputs_descriptor_, &FormInputs::default_instance()); @@ -167,11 +241,19 @@ void protobuf_RegisterTypes(const ::std::string&) { LoginForm_descriptor_, &LoginForm::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( LoginResult_descriptor_, &LoginResult::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + LoginRefreshResult_descriptor_, &LoginRefreshResult::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + GameAccountInfo_descriptor_, &GameAccountInfo::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + GameAccountList_descriptor_, &GameAccountList::default_instance()); } } // namespace void protobuf_ShutdownFile_Login_2eproto() { + delete ErrorResponse::default_instance_; + delete ErrorResponse_reflection_; delete FormInput::default_instance_; delete FormInput_reflection_; delete FormInputs::default_instance_; @@ -182,6 +264,12 @@ void protobuf_ShutdownFile_Login_2eproto() { delete LoginForm_reflection_; delete LoginResult::default_instance_; delete LoginResult_reflection_; + delete LoginRefreshResult::default_instance_; + delete LoginRefreshResult_reflection_; + delete GameAccountInfo::default_instance_; + delete GameAccountInfo_reflection_; + delete GameAccountList::default_instance_; + delete GameAccountList_reflection_; } void protobuf_AddDesc_Login_2eproto() { @@ -191,35 +279,51 @@ void protobuf_AddDesc_Login_2eproto() { GOOGLE_PROTOBUF_VERIFY_VERSION; ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( - "\n\013Login.proto\022\024Battlenet.JSON.Login\"N\n\tF" - "ormInput\022\020\n\010input_id\030\001 \002(\t\022\014\n\004type\030\002 \002(\t" - "\022\r\n\005label\030\003 \002(\t\022\022\n\nmax_length\030\004 \001(\r\"k\n\nF" - "ormInputs\022,\n\004type\030\001 \002(\0162\036.Battlenet.JSON" - ".Login.FormType\022/\n\006inputs\030\002 \003(\0132\037.Battle" - "net.JSON.Login.FormInput\"1\n\016FormInputVal" - "ue\022\020\n\010input_id\030\001 \002(\t\022\r\n\005value\030\002 \002(\t\"{\n\tL" - "oginForm\022\023\n\013platform_id\030\001 \002(\t\022\022\n\nprogram" - "_id\030\002 \002(\t\022\017\n\007version\030\003 \002(\t\0224\n\006inputs\030\004 \003" - "(\0132$.Battlenet.JSON.Login.FormInputValue" - "\"\244\001\n\013LoginResult\022G\n\024authentication_state" - "\030\001 \002(\0162).Battlenet.JSON.Login.Authentica" - "tionState\022\022\n\nerror_code\030\002 \001(\t\022\025\n\rerror_m" - "essage\030\003 \001(\t\022\013\n\003url\030\004 \001(\t\022\024\n\014login_ticke" - "t\030\005 \001(\t*\032\n\010FormType\022\016\n\nLOGIN_FORM\020\001*H\n\023A" - "uthenticationState\022\t\n\005LOGIN\020\001\022\t\n\005LEGAL\020\002" - "\022\021\n\rAUTHENTICATOR\020\003\022\010\n\004DONE\020\004B\002H\002", 673); + "\n\013Login.proto\022\024Battlenet.JSON.Login\"\017\n\rE" + "rrorResponse\"N\n\tFormInput\022\020\n\010input_id\030\001 " + "\002(\t\022\014\n\004type\030\002 \002(\t\022\r\n\005label\030\003 \002(\t\022\022\n\nmax_" + "length\030\004 \001(\r\"k\n\nFormInputs\022,\n\004type\030\001 \002(\016" + "2\036.Battlenet.JSON.Login.FormType\022/\n\006inpu" + "ts\030\002 \003(\0132\037.Battlenet.JSON.Login.FormInpu" + "t\"1\n\016FormInputValue\022\020\n\010input_id\030\001 \002(\t\022\r\n" + "\005value\030\002 \002(\t\"{\n\tLoginForm\022\023\n\013platform_id" + "\030\001 \002(\t\022\022\n\nprogram_id\030\002 \002(\t\022\017\n\007version\030\003 " + "\002(\t\0224\n\006inputs\030\004 \003(\0132$.Battlenet.JSON.Log" + "in.FormInputValue\"\244\001\n\013LoginResult\022G\n\024aut" + "hentication_state\030\001 \002(\0162).Battlenet.JSON" + ".Login.AuthenticationState\022\022\n\nerror_code" + "\030\002 \001(\t\022\025\n\rerror_message\030\003 \001(\t\022\013\n\003url\030\004 \001" + "(\t\022\024\n\014login_ticket\030\005 \001(\t\"E\n\022LoginRefresh" + "Result\022\033\n\023login_ticket_expiry\030\001 \002(\004\022\022\n\ni" + "s_expired\030\002 \001(\010\"\232\001\n\017GameAccountInfo\022\024\n\014d" + "isplay_name\030\001 \002(\t\022\021\n\texpansion\030\002 \002(\r\022\024\n\014" + "is_suspended\030\003 \001(\010\022\021\n\tis_banned\030\004 \001(\010\022\032\n" + "\022suspension_expires\030\005 \001(\004\022\031\n\021suspension_" + "reason\030\006 \001(\t\"O\n\017GameAccountList\022<\n\rgame_" + "accounts\030\001 \003(\0132%.Battlenet.JSON.Login.Ga" + "meAccountInfo*\032\n\010FormType\022\016\n\nLOGIN_FORM\020" + "\001*H\n\023AuthenticationState\022\t\n\005LOGIN\020\001\022\t\n\005L" + "EGAL\020\002\022\021\n\rAUTHENTICATOR\020\003\022\010\n\004DONE\020\004B\002H\002", 999); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "Login.proto", &protobuf_RegisterTypes); + ErrorResponse::default_instance_ = new ErrorResponse(); FormInput::default_instance_ = new FormInput(); FormInputs::default_instance_ = new FormInputs(); FormInputValue::default_instance_ = new FormInputValue(); LoginForm::default_instance_ = new LoginForm(); LoginResult::default_instance_ = new LoginResult(); + LoginRefreshResult::default_instance_ = new LoginRefreshResult(); + GameAccountInfo::default_instance_ = new GameAccountInfo(); + GameAccountList::default_instance_ = new GameAccountList(); + ErrorResponse::default_instance_->InitAsDefaultInstance(); FormInput::default_instance_->InitAsDefaultInstance(); FormInputs::default_instance_->InitAsDefaultInstance(); FormInputValue::default_instance_->InitAsDefaultInstance(); LoginForm::default_instance_->InitAsDefaultInstance(); LoginResult::default_instance_->InitAsDefaultInstance(); + LoginRefreshResult::default_instance_->InitAsDefaultInstance(); + GameAccountInfo::default_instance_->InitAsDefaultInstance(); + GameAccountList::default_instance_->InitAsDefaultInstance(); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_Login_2eproto); } @@ -262,6 +366,77 @@ bool AuthenticationState_IsValid(int value) { // =================================================================== #ifndef _MSC_VER +#endif // !_MSC_VER + +ErrorResponse::ErrorResponse() + : ::google::protobuf::Message() { + SharedCtor(); + // @@protoc_insertion_point(constructor:Battlenet.JSON.Login.ErrorResponse) +} + +void ErrorResponse::InitAsDefaultInstance() { +} + +ErrorResponse::ErrorResponse(const ErrorResponse& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:Battlenet.JSON.Login.ErrorResponse) +} + +void ErrorResponse::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +ErrorResponse::~ErrorResponse() { + // @@protoc_insertion_point(destructor:Battlenet.JSON.Login.ErrorResponse) + SharedDtor(); +} + +void ErrorResponse::SharedDtor() { + if (this != default_instance_) { + } +} + +void ErrorResponse::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* ErrorResponse::descriptor() { + protobuf_AssignDescriptorsOnce(); + return ErrorResponse_descriptor_; +} + +const ErrorResponse& ErrorResponse::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_Login_2eproto(); + return *default_instance_; +} + +ErrorResponse* ErrorResponse::default_instance_ = NULL; + +ErrorResponse* ErrorResponse::New() const { + return new ErrorResponse; +} + +void ErrorResponse::Swap(ErrorResponse* other) { + if (other != this) { + GetReflection()->Swap(this, other);} +} + +::google::protobuf::Metadata ErrorResponse::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = ErrorResponse_descriptor_; + metadata.reflection = ErrorResponse_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER const int FormInput::kInputIdFieldNumber; const int FormInput::kTypeFieldNumber; const int FormInput::kLabelFieldNumber; @@ -686,6 +861,243 @@ void LoginResult::Swap(LoginResult* other) { } +// =================================================================== + +#ifndef _MSC_VER +const int LoginRefreshResult::kLoginTicketExpiryFieldNumber; +const int LoginRefreshResult::kIsExpiredFieldNumber; +#endif // !_MSC_VER + +LoginRefreshResult::LoginRefreshResult() + : ::google::protobuf::Message() { + SharedCtor(); + // @@protoc_insertion_point(constructor:Battlenet.JSON.Login.LoginRefreshResult) +} + +void LoginRefreshResult::InitAsDefaultInstance() { +} + +LoginRefreshResult::LoginRefreshResult(const LoginRefreshResult& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:Battlenet.JSON.Login.LoginRefreshResult) +} + +void LoginRefreshResult::SharedCtor() { + _cached_size_ = 0; + login_ticket_expiry_ = GOOGLE_ULONGLONG(0); + is_expired_ = false; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +LoginRefreshResult::~LoginRefreshResult() { + // @@protoc_insertion_point(destructor:Battlenet.JSON.Login.LoginRefreshResult) + SharedDtor(); +} + +void LoginRefreshResult::SharedDtor() { + if (this != default_instance_) { + } +} + +void LoginRefreshResult::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* LoginRefreshResult::descriptor() { + protobuf_AssignDescriptorsOnce(); + return LoginRefreshResult_descriptor_; +} + +const LoginRefreshResult& LoginRefreshResult::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_Login_2eproto(); + return *default_instance_; +} + +LoginRefreshResult* LoginRefreshResult::default_instance_ = NULL; + +LoginRefreshResult* LoginRefreshResult::New() const { + return new LoginRefreshResult; +} + +void LoginRefreshResult::Swap(LoginRefreshResult* other) { + if (other != this) { + GetReflection()->Swap(this, other);} +} + +::google::protobuf::Metadata LoginRefreshResult::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = LoginRefreshResult_descriptor_; + metadata.reflection = LoginRefreshResult_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int GameAccountInfo::kDisplayNameFieldNumber; +const int GameAccountInfo::kExpansionFieldNumber; +const int GameAccountInfo::kIsSuspendedFieldNumber; +const int GameAccountInfo::kIsBannedFieldNumber; +const int GameAccountInfo::kSuspensionExpiresFieldNumber; +const int GameAccountInfo::kSuspensionReasonFieldNumber; +#endif // !_MSC_VER + +GameAccountInfo::GameAccountInfo() + : ::google::protobuf::Message() { + SharedCtor(); + // @@protoc_insertion_point(constructor:Battlenet.JSON.Login.GameAccountInfo) +} + +void GameAccountInfo::InitAsDefaultInstance() { +} + +GameAccountInfo::GameAccountInfo(const GameAccountInfo& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:Battlenet.JSON.Login.GameAccountInfo) +} + +void GameAccountInfo::SharedCtor() { + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + display_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + expansion_ = 0u; + is_suspended_ = false; + is_banned_ = false; + suspension_expires_ = GOOGLE_ULONGLONG(0); + suspension_reason_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +GameAccountInfo::~GameAccountInfo() { + // @@protoc_insertion_point(destructor:Battlenet.JSON.Login.GameAccountInfo) + SharedDtor(); +} + +void GameAccountInfo::SharedDtor() { + if (display_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete display_name_; + } + if (suspension_reason_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete suspension_reason_; + } + if (this != default_instance_) { + } +} + +void GameAccountInfo::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* GameAccountInfo::descriptor() { + protobuf_AssignDescriptorsOnce(); + return GameAccountInfo_descriptor_; +} + +const GameAccountInfo& GameAccountInfo::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_Login_2eproto(); + return *default_instance_; +} + +GameAccountInfo* GameAccountInfo::default_instance_ = NULL; + +GameAccountInfo* GameAccountInfo::New() const { + return new GameAccountInfo; +} + +void GameAccountInfo::Swap(GameAccountInfo* other) { + if (other != this) { + GetReflection()->Swap(this, other);} +} + +::google::protobuf::Metadata GameAccountInfo::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = GameAccountInfo_descriptor_; + metadata.reflection = GameAccountInfo_reflection_; + return metadata; +} + + +// =================================================================== + +#ifndef _MSC_VER +const int GameAccountList::kGameAccountsFieldNumber; +#endif // !_MSC_VER + +GameAccountList::GameAccountList() + : ::google::protobuf::Message() { + SharedCtor(); + // @@protoc_insertion_point(constructor:Battlenet.JSON.Login.GameAccountList) +} + +void GameAccountList::InitAsDefaultInstance() { +} + +GameAccountList::GameAccountList(const GameAccountList& from) + : ::google::protobuf::Message() { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:Battlenet.JSON.Login.GameAccountList) +} + +void GameAccountList::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +GameAccountList::~GameAccountList() { + // @@protoc_insertion_point(destructor:Battlenet.JSON.Login.GameAccountList) + SharedDtor(); +} + +void GameAccountList::SharedDtor() { + if (this != default_instance_) { + } +} + +void GameAccountList::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* GameAccountList::descriptor() { + protobuf_AssignDescriptorsOnce(); + return GameAccountList_descriptor_; +} + +const GameAccountList& GameAccountList::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_Login_2eproto(); + return *default_instance_; +} + +GameAccountList* GameAccountList::default_instance_ = NULL; + +GameAccountList* GameAccountList::New() const { + return new GameAccountList; +} + +void GameAccountList::Swap(GameAccountList* other) { + if (other != this) { + GetReflection()->Swap(this, other);} +} + +::google::protobuf::Metadata GameAccountList::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = GameAccountList_descriptor_; + metadata.reflection = GameAccountList_reflection_; + return metadata; +} + + // @@protoc_insertion_point(namespace_scope) } // namespace Login diff --git a/src/server/proto/Login/Login.pb.h b/src/server/proto/Login/Login.pb.h index 9fcafbc365e..9ab5feb0787 100644 --- a/src/server/proto/Login/Login.pb.h +++ b/src/server/proto/Login/Login.pb.h @@ -37,11 +37,15 @@ void TC_PROTO_API protobuf_AddDesc_Login_2eproto(); void protobuf_AssignDesc_Login_2eproto(); void protobuf_ShutdownFile_Login_2eproto(); +class ErrorResponse; class FormInput; class FormInputs; class FormInputValue; class LoginForm; class LoginResult; +class LoginRefreshResult; +class GameAccountInfo; +class GameAccountList; enum FormType { LOGIN_FORM = 1 @@ -84,6 +88,62 @@ inline bool AuthenticationState_Parse( } // =================================================================== +class TC_PROTO_API ErrorResponse : public ::google::protobuf::Message { + public: + ErrorResponse(); + virtual ~ErrorResponse(); + + ErrorResponse(const ErrorResponse& from); + + inline ErrorResponse& operator=(const ErrorResponse& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const ErrorResponse& default_instance(); + + void Swap(ErrorResponse* other); + + // implements Message ---------------------------------------------- + + ErrorResponse* New() const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // @@protoc_insertion_point(class_scope:Battlenet.JSON.Login.ErrorResponse) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + friend void TC_PROTO_API protobuf_AddDesc_Login_2eproto(); + friend void protobuf_AssignDesc_Login_2eproto(); + friend void protobuf_ShutdownFile_Login_2eproto(); + + void InitAsDefaultInstance(); + static ErrorResponse* default_instance_; +}; +// ------------------------------------------------------------------- + class TC_PROTO_API FormInput : public ::google::protobuf::Message { public: FormInput(); @@ -598,6 +658,277 @@ class TC_PROTO_API LoginResult : public ::google::protobuf::Message { void InitAsDefaultInstance(); static LoginResult* default_instance_; }; +// ------------------------------------------------------------------- + +class TC_PROTO_API LoginRefreshResult : public ::google::protobuf::Message { + public: + LoginRefreshResult(); + virtual ~LoginRefreshResult(); + + LoginRefreshResult(const LoginRefreshResult& from); + + inline LoginRefreshResult& operator=(const LoginRefreshResult& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const LoginRefreshResult& default_instance(); + + void Swap(LoginRefreshResult* other); + + // implements Message ---------------------------------------------- + + LoginRefreshResult* New() const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required uint64 login_ticket_expiry = 1; + inline bool has_login_ticket_expiry() const; + inline void clear_login_ticket_expiry(); + static const int kLoginTicketExpiryFieldNumber = 1; + inline ::google::protobuf::uint64 login_ticket_expiry() const; + inline void set_login_ticket_expiry(::google::protobuf::uint64 value); + + // optional bool is_expired = 2; + inline bool has_is_expired() const; + inline void clear_is_expired(); + static const int kIsExpiredFieldNumber = 2; + inline bool is_expired() const; + inline void set_is_expired(bool value); + + // @@protoc_insertion_point(class_scope:Battlenet.JSON.Login.LoginRefreshResult) + private: + inline void set_has_login_ticket_expiry(); + inline void clear_has_login_ticket_expiry(); + inline void set_has_is_expired(); + inline void clear_has_is_expired(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + ::google::protobuf::uint64 login_ticket_expiry_; + bool is_expired_; + friend void TC_PROTO_API protobuf_AddDesc_Login_2eproto(); + friend void protobuf_AssignDesc_Login_2eproto(); + friend void protobuf_ShutdownFile_Login_2eproto(); + + void InitAsDefaultInstance(); + static LoginRefreshResult* default_instance_; +}; +// ------------------------------------------------------------------- + +class TC_PROTO_API GameAccountInfo : public ::google::protobuf::Message { + public: + GameAccountInfo(); + virtual ~GameAccountInfo(); + + GameAccountInfo(const GameAccountInfo& from); + + inline GameAccountInfo& operator=(const GameAccountInfo& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const GameAccountInfo& default_instance(); + + void Swap(GameAccountInfo* other); + + // implements Message ---------------------------------------------- + + GameAccountInfo* New() const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required string display_name = 1; + inline bool has_display_name() const; + inline void clear_display_name(); + static const int kDisplayNameFieldNumber = 1; + inline const ::std::string& display_name() const; + inline void set_display_name(const ::std::string& value); + inline void set_display_name(const char* value); + inline void set_display_name(const char* value, size_t size); + inline ::std::string* mutable_display_name(); + inline ::std::string* release_display_name(); + inline void set_allocated_display_name(::std::string* display_name); + + // required uint32 expansion = 2; + inline bool has_expansion() const; + inline void clear_expansion(); + static const int kExpansionFieldNumber = 2; + inline ::google::protobuf::uint32 expansion() const; + inline void set_expansion(::google::protobuf::uint32 value); + + // optional bool is_suspended = 3; + inline bool has_is_suspended() const; + inline void clear_is_suspended(); + static const int kIsSuspendedFieldNumber = 3; + inline bool is_suspended() const; + inline void set_is_suspended(bool value); + + // optional bool is_banned = 4; + inline bool has_is_banned() const; + inline void clear_is_banned(); + static const int kIsBannedFieldNumber = 4; + inline bool is_banned() const; + inline void set_is_banned(bool value); + + // optional uint64 suspension_expires = 5; + inline bool has_suspension_expires() const; + inline void clear_suspension_expires(); + static const int kSuspensionExpiresFieldNumber = 5; + inline ::google::protobuf::uint64 suspension_expires() const; + inline void set_suspension_expires(::google::protobuf::uint64 value); + + // optional string suspension_reason = 6; + inline bool has_suspension_reason() const; + inline void clear_suspension_reason(); + static const int kSuspensionReasonFieldNumber = 6; + inline const ::std::string& suspension_reason() const; + inline void set_suspension_reason(const ::std::string& value); + inline void set_suspension_reason(const char* value); + inline void set_suspension_reason(const char* value, size_t size); + inline ::std::string* mutable_suspension_reason(); + inline ::std::string* release_suspension_reason(); + inline void set_allocated_suspension_reason(::std::string* suspension_reason); + + // @@protoc_insertion_point(class_scope:Battlenet.JSON.Login.GameAccountInfo) + private: + inline void set_has_display_name(); + inline void clear_has_display_name(); + inline void set_has_expansion(); + inline void clear_has_expansion(); + inline void set_has_is_suspended(); + inline void clear_has_is_suspended(); + inline void set_has_is_banned(); + inline void clear_has_is_banned(); + inline void set_has_suspension_expires(); + inline void clear_has_suspension_expires(); + inline void set_has_suspension_reason(); + inline void clear_has_suspension_reason(); + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + ::std::string* display_name_; + ::google::protobuf::uint32 expansion_; + bool is_suspended_; + bool is_banned_; + ::google::protobuf::uint64 suspension_expires_; + ::std::string* suspension_reason_; + friend void TC_PROTO_API protobuf_AddDesc_Login_2eproto(); + friend void protobuf_AssignDesc_Login_2eproto(); + friend void protobuf_ShutdownFile_Login_2eproto(); + + void InitAsDefaultInstance(); + static GameAccountInfo* default_instance_; +}; +// ------------------------------------------------------------------- + +class TC_PROTO_API GameAccountList : public ::google::protobuf::Message { + public: + GameAccountList(); + virtual ~GameAccountList(); + + GameAccountList(const GameAccountList& from); + + inline GameAccountList& operator=(const GameAccountList& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _unknown_fields_; + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return &_unknown_fields_; + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const GameAccountList& default_instance(); + + void Swap(GameAccountList* other); + + // implements Message ---------------------------------------------- + + GameAccountList* New() const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated .Battlenet.JSON.Login.GameAccountInfo game_accounts = 1; + inline int game_accounts_size() const; + inline void clear_game_accounts(); + static const int kGameAccountsFieldNumber = 1; + inline const ::Battlenet::JSON::Login::GameAccountInfo& game_accounts(int index) const; + inline ::Battlenet::JSON::Login::GameAccountInfo* mutable_game_accounts(int index); + inline ::Battlenet::JSON::Login::GameAccountInfo* add_game_accounts(); + inline const ::google::protobuf::RepeatedPtrField< ::Battlenet::JSON::Login::GameAccountInfo >& + game_accounts() const; + inline ::google::protobuf::RepeatedPtrField< ::Battlenet::JSON::Login::GameAccountInfo >* + mutable_game_accounts(); + + // @@protoc_insertion_point(class_scope:Battlenet.JSON.Login.GameAccountList) + private: + + ::google::protobuf::UnknownFieldSet _unknown_fields_; + + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + ::google::protobuf::RepeatedPtrField< ::Battlenet::JSON::Login::GameAccountInfo > game_accounts_; + friend void TC_PROTO_API protobuf_AddDesc_Login_2eproto(); + friend void protobuf_AssignDesc_Login_2eproto(); + friend void protobuf_ShutdownFile_Login_2eproto(); + + void InitAsDefaultInstance(); + static GameAccountList* default_instance_; +}; // =================================================================== @@ -606,6 +937,10 @@ class TC_PROTO_API LoginResult : public ::google::protobuf::Message { // =================================================================== +// ErrorResponse + +// ------------------------------------------------------------------- + // FormInput // required string input_id = 1; @@ -1670,6 +2005,344 @@ inline void LoginResult::set_allocated_login_ticket(::std::string* login_ticket) // @@protoc_insertion_point(field_set_allocated:Battlenet.JSON.Login.LoginResult.login_ticket) } +// ------------------------------------------------------------------- + +// LoginRefreshResult + +// required uint64 login_ticket_expiry = 1; +inline bool LoginRefreshResult::has_login_ticket_expiry() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void LoginRefreshResult::set_has_login_ticket_expiry() { + _has_bits_[0] |= 0x00000001u; +} +inline void LoginRefreshResult::clear_has_login_ticket_expiry() { + _has_bits_[0] &= ~0x00000001u; +} +inline void LoginRefreshResult::clear_login_ticket_expiry() { + login_ticket_expiry_ = GOOGLE_ULONGLONG(0); + clear_has_login_ticket_expiry(); +} +inline ::google::protobuf::uint64 LoginRefreshResult::login_ticket_expiry() const { + // @@protoc_insertion_point(field_get:Battlenet.JSON.Login.LoginRefreshResult.login_ticket_expiry) + return login_ticket_expiry_; +} +inline void LoginRefreshResult::set_login_ticket_expiry(::google::protobuf::uint64 value) { + set_has_login_ticket_expiry(); + login_ticket_expiry_ = value; + // @@protoc_insertion_point(field_set:Battlenet.JSON.Login.LoginRefreshResult.login_ticket_expiry) +} + +// optional bool is_expired = 2; +inline bool LoginRefreshResult::has_is_expired() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void LoginRefreshResult::set_has_is_expired() { + _has_bits_[0] |= 0x00000002u; +} +inline void LoginRefreshResult::clear_has_is_expired() { + _has_bits_[0] &= ~0x00000002u; +} +inline void LoginRefreshResult::clear_is_expired() { + is_expired_ = false; + clear_has_is_expired(); +} +inline bool LoginRefreshResult::is_expired() const { + // @@protoc_insertion_point(field_get:Battlenet.JSON.Login.LoginRefreshResult.is_expired) + return is_expired_; +} +inline void LoginRefreshResult::set_is_expired(bool value) { + set_has_is_expired(); + is_expired_ = value; + // @@protoc_insertion_point(field_set:Battlenet.JSON.Login.LoginRefreshResult.is_expired) +} + +// ------------------------------------------------------------------- + +// GameAccountInfo + +// required string display_name = 1; +inline bool GameAccountInfo::has_display_name() const { + return (_has_bits_[0] & 0x00000001u) != 0; +} +inline void GameAccountInfo::set_has_display_name() { + _has_bits_[0] |= 0x00000001u; +} +inline void GameAccountInfo::clear_has_display_name() { + _has_bits_[0] &= ~0x00000001u; +} +inline void GameAccountInfo::clear_display_name() { + if (display_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + display_name_->clear(); + } + clear_has_display_name(); +} +inline const ::std::string& GameAccountInfo::display_name() const { + // @@protoc_insertion_point(field_get:Battlenet.JSON.Login.GameAccountInfo.display_name) + return *display_name_; +} +inline void GameAccountInfo::set_display_name(const ::std::string& value) { + set_has_display_name(); + if (display_name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + display_name_ = new ::std::string; + } + display_name_->assign(value); + // @@protoc_insertion_point(field_set:Battlenet.JSON.Login.GameAccountInfo.display_name) +} +inline void GameAccountInfo::set_display_name(const char* value) { + set_has_display_name(); + if (display_name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + display_name_ = new ::std::string; + } + display_name_->assign(value); + // @@protoc_insertion_point(field_set_char:Battlenet.JSON.Login.GameAccountInfo.display_name) +} +inline void GameAccountInfo::set_display_name(const char* value, size_t size) { + set_has_display_name(); + if (display_name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + display_name_ = new ::std::string; + } + display_name_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:Battlenet.JSON.Login.GameAccountInfo.display_name) +} +inline ::std::string* GameAccountInfo::mutable_display_name() { + set_has_display_name(); + if (display_name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + display_name_ = new ::std::string; + } + // @@protoc_insertion_point(field_mutable:Battlenet.JSON.Login.GameAccountInfo.display_name) + return display_name_; +} +inline ::std::string* GameAccountInfo::release_display_name() { + clear_has_display_name(); + if (display_name_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + return NULL; + } else { + ::std::string* temp = display_name_; + display_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return temp; + } +} +inline void GameAccountInfo::set_allocated_display_name(::std::string* display_name) { + if (display_name_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete display_name_; + } + if (display_name) { + set_has_display_name(); + display_name_ = display_name; + } else { + clear_has_display_name(); + display_name_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_set_allocated:Battlenet.JSON.Login.GameAccountInfo.display_name) +} + +// required uint32 expansion = 2; +inline bool GameAccountInfo::has_expansion() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void GameAccountInfo::set_has_expansion() { + _has_bits_[0] |= 0x00000002u; +} +inline void GameAccountInfo::clear_has_expansion() { + _has_bits_[0] &= ~0x00000002u; +} +inline void GameAccountInfo::clear_expansion() { + expansion_ = 0u; + clear_has_expansion(); +} +inline ::google::protobuf::uint32 GameAccountInfo::expansion() const { + // @@protoc_insertion_point(field_get:Battlenet.JSON.Login.GameAccountInfo.expansion) + return expansion_; +} +inline void GameAccountInfo::set_expansion(::google::protobuf::uint32 value) { + set_has_expansion(); + expansion_ = value; + // @@protoc_insertion_point(field_set:Battlenet.JSON.Login.GameAccountInfo.expansion) +} + +// optional bool is_suspended = 3; +inline bool GameAccountInfo::has_is_suspended() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void GameAccountInfo::set_has_is_suspended() { + _has_bits_[0] |= 0x00000004u; +} +inline void GameAccountInfo::clear_has_is_suspended() { + _has_bits_[0] &= ~0x00000004u; +} +inline void GameAccountInfo::clear_is_suspended() { + is_suspended_ = false; + clear_has_is_suspended(); +} +inline bool GameAccountInfo::is_suspended() const { + // @@protoc_insertion_point(field_get:Battlenet.JSON.Login.GameAccountInfo.is_suspended) + return is_suspended_; +} +inline void GameAccountInfo::set_is_suspended(bool value) { + set_has_is_suspended(); + is_suspended_ = value; + // @@protoc_insertion_point(field_set:Battlenet.JSON.Login.GameAccountInfo.is_suspended) +} + +// optional bool is_banned = 4; +inline bool GameAccountInfo::has_is_banned() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void GameAccountInfo::set_has_is_banned() { + _has_bits_[0] |= 0x00000008u; +} +inline void GameAccountInfo::clear_has_is_banned() { + _has_bits_[0] &= ~0x00000008u; +} +inline void GameAccountInfo::clear_is_banned() { + is_banned_ = false; + clear_has_is_banned(); +} +inline bool GameAccountInfo::is_banned() const { + // @@protoc_insertion_point(field_get:Battlenet.JSON.Login.GameAccountInfo.is_banned) + return is_banned_; +} +inline void GameAccountInfo::set_is_banned(bool value) { + set_has_is_banned(); + is_banned_ = value; + // @@protoc_insertion_point(field_set:Battlenet.JSON.Login.GameAccountInfo.is_banned) +} + +// optional uint64 suspension_expires = 5; +inline bool GameAccountInfo::has_suspension_expires() const { + return (_has_bits_[0] & 0x00000010u) != 0; +} +inline void GameAccountInfo::set_has_suspension_expires() { + _has_bits_[0] |= 0x00000010u; +} +inline void GameAccountInfo::clear_has_suspension_expires() { + _has_bits_[0] &= ~0x00000010u; +} +inline void GameAccountInfo::clear_suspension_expires() { + suspension_expires_ = GOOGLE_ULONGLONG(0); + clear_has_suspension_expires(); +} +inline ::google::protobuf::uint64 GameAccountInfo::suspension_expires() const { + // @@protoc_insertion_point(field_get:Battlenet.JSON.Login.GameAccountInfo.suspension_expires) + return suspension_expires_; +} +inline void GameAccountInfo::set_suspension_expires(::google::protobuf::uint64 value) { + set_has_suspension_expires(); + suspension_expires_ = value; + // @@protoc_insertion_point(field_set:Battlenet.JSON.Login.GameAccountInfo.suspension_expires) +} + +// optional string suspension_reason = 6; +inline bool GameAccountInfo::has_suspension_reason() const { + return (_has_bits_[0] & 0x00000020u) != 0; +} +inline void GameAccountInfo::set_has_suspension_reason() { + _has_bits_[0] |= 0x00000020u; +} +inline void GameAccountInfo::clear_has_suspension_reason() { + _has_bits_[0] &= ~0x00000020u; +} +inline void GameAccountInfo::clear_suspension_reason() { + if (suspension_reason_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + suspension_reason_->clear(); + } + clear_has_suspension_reason(); +} +inline const ::std::string& GameAccountInfo::suspension_reason() const { + // @@protoc_insertion_point(field_get:Battlenet.JSON.Login.GameAccountInfo.suspension_reason) + return *suspension_reason_; +} +inline void GameAccountInfo::set_suspension_reason(const ::std::string& value) { + set_has_suspension_reason(); + if (suspension_reason_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + suspension_reason_ = new ::std::string; + } + suspension_reason_->assign(value); + // @@protoc_insertion_point(field_set:Battlenet.JSON.Login.GameAccountInfo.suspension_reason) +} +inline void GameAccountInfo::set_suspension_reason(const char* value) { + set_has_suspension_reason(); + if (suspension_reason_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + suspension_reason_ = new ::std::string; + } + suspension_reason_->assign(value); + // @@protoc_insertion_point(field_set_char:Battlenet.JSON.Login.GameAccountInfo.suspension_reason) +} +inline void GameAccountInfo::set_suspension_reason(const char* value, size_t size) { + set_has_suspension_reason(); + if (suspension_reason_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + suspension_reason_ = new ::std::string; + } + suspension_reason_->assign(reinterpret_cast<const char*>(value), size); + // @@protoc_insertion_point(field_set_pointer:Battlenet.JSON.Login.GameAccountInfo.suspension_reason) +} +inline ::std::string* GameAccountInfo::mutable_suspension_reason() { + set_has_suspension_reason(); + if (suspension_reason_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + suspension_reason_ = new ::std::string; + } + // @@protoc_insertion_point(field_mutable:Battlenet.JSON.Login.GameAccountInfo.suspension_reason) + return suspension_reason_; +} +inline ::std::string* GameAccountInfo::release_suspension_reason() { + clear_has_suspension_reason(); + if (suspension_reason_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + return NULL; + } else { + ::std::string* temp = suspension_reason_; + suspension_reason_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + return temp; + } +} +inline void GameAccountInfo::set_allocated_suspension_reason(::std::string* suspension_reason) { + if (suspension_reason_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) { + delete suspension_reason_; + } + if (suspension_reason) { + set_has_suspension_reason(); + suspension_reason_ = suspension_reason; + } else { + clear_has_suspension_reason(); + suspension_reason_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + // @@protoc_insertion_point(field_set_allocated:Battlenet.JSON.Login.GameAccountInfo.suspension_reason) +} + +// ------------------------------------------------------------------- + +// GameAccountList + +// repeated .Battlenet.JSON.Login.GameAccountInfo game_accounts = 1; +inline int GameAccountList::game_accounts_size() const { + return game_accounts_.size(); +} +inline void GameAccountList::clear_game_accounts() { + game_accounts_.Clear(); +} +inline const ::Battlenet::JSON::Login::GameAccountInfo& GameAccountList::game_accounts(int index) const { + // @@protoc_insertion_point(field_get:Battlenet.JSON.Login.GameAccountList.game_accounts) + return game_accounts_.Get(index); +} +inline ::Battlenet::JSON::Login::GameAccountInfo* GameAccountList::mutable_game_accounts(int index) { + // @@protoc_insertion_point(field_mutable:Battlenet.JSON.Login.GameAccountList.game_accounts) + return game_accounts_.Mutable(index); +} +inline ::Battlenet::JSON::Login::GameAccountInfo* GameAccountList::add_game_accounts() { + // @@protoc_insertion_point(field_add:Battlenet.JSON.Login.GameAccountList.game_accounts) + return game_accounts_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::Battlenet::JSON::Login::GameAccountInfo >& +GameAccountList::game_accounts() const { + // @@protoc_insertion_point(field_list:Battlenet.JSON.Login.GameAccountList.game_accounts) + return game_accounts_; +} +inline ::google::protobuf::RepeatedPtrField< ::Battlenet::JSON::Login::GameAccountInfo >* +GameAccountList::mutable_game_accounts() { + // @@protoc_insertion_point(field_mutable_list:Battlenet.JSON.Login.GameAccountList.game_accounts) + return &game_accounts_; +} + // @@protoc_insertion_point(namespace_scope) diff --git a/src/server/proto/Login/Login.proto b/src/server/proto/Login/Login.proto index 35f690a5d4c..58e436166c1 100644 --- a/src/server/proto/Login/Login.proto +++ b/src/server/proto/Login/Login.proto @@ -4,6 +4,9 @@ package Battlenet.JSON.Login; option optimize_for = CODE_SIZE; +message ErrorResponse { +} + enum FormType { LOGIN_FORM = 1; } @@ -46,3 +49,21 @@ message LoginResult { optional string url = 4; optional string login_ticket = 5; } + +message LoginRefreshResult { + required uint64 login_ticket_expiry = 1; + optional bool is_expired = 2; +} + +message GameAccountInfo { + required string display_name = 1; + required uint32 expansion = 2; + optional bool is_suspended = 3; + optional bool is_banned = 4; + optional uint64 suspension_expires = 5; + optional string suspension_reason = 6; +} + +message GameAccountList { + repeated GameAccountInfo game_accounts = 1; +} diff --git a/src/server/scripts/Commands/cs_battlenet_account.cpp b/src/server/scripts/Commands/cs_battlenet_account.cpp index 32649f1c7d7..2ad831993e8 100644 --- a/src/server/scripts/Commands/cs_battlenet_account.cpp +++ b/src/server/scripts/Commands/cs_battlenet_account.cpp @@ -477,7 +477,7 @@ public: return false; char* battlenetAccountName = strtok((char*)args, " "); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_GAME_ACCOUNT_LIST); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_GAME_ACCOUNT_LIST_SMALL); stmt->setString(0, battlenetAccountName); if (PreparedQueryResult accountList = LoginDatabase.Query(stmt)) { diff --git a/src/tools/connection_patcher/Patches/Common.hpp b/src/tools/connection_patcher/Patches/Common.hpp index e2c96c4c7e2..5bf6464249a 100644 --- a/src/tools/connection_patcher/Patches/Common.hpp +++ b/src/tools/connection_patcher/Patches/Common.hpp @@ -68,6 +68,11 @@ R"({ ] }NGISerting_dummy_signature_inserting_dummy_signature_inserting_dummy_signature_inserting_dummy_signature_inserting_dummy_signature_inserting_dummy_signature_inserting_dummy_signature_inserting_dummy_signature_inserting_dummy_signature_inserting_dummy_signature)"; } + static std::vector<unsigned char> LauncherLoginParametersLocation() + { + char const path[] = R"(Software\TrinityCore Developers\Battle.net\Launch Options\)"; + return std::vector<unsigned char>(std::begin(path), std::end(path)); + } }; } } diff --git a/src/tools/connection_patcher/Patterns/Common.hpp b/src/tools/connection_patcher/Patterns/Common.hpp index a8cf0ca7934..6144a01f642 100644 --- a/src/tools/connection_patcher/Patterns/Common.hpp +++ b/src/tools/connection_patcher/Patterns/Common.hpp @@ -32,6 +32,11 @@ namespace Connection_Patcher static const std::vector<unsigned char> BinaryVersion() { return{ 0x3C, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3E }; } static const std::vector<unsigned char> VersionsFile() { return { '%', 's', '.', 'p', 'a', 't', 'c', 'h', '.', 'b', 'a', 't', 't', 'l', 'e', '.', 'n', 'e', 't', ':', '1', '1', '1', '9', '/', '%', 's', '/', 'v', 'e', 'r', 's', 'i', 'o', 'n', 's' }; } static const std::vector<unsigned char> CertFileName() { return { 'c', 'a', '_', 'b', 'u', 'n', 'd', 'l', 'e', '.', 't', 'x', 't', '.', 's', 'i', 'g', 'n', 'e', 'd', 0x00 }; } + static const std::vector<unsigned char> LauncherLoginParametersLocation() + { + char const path[] = R"(Software\Blizzard Entertainment\Battle.net\Launch Options\)"; + return std::vector<unsigned char>(std::begin(path), std::end(path)); + } }; } } diff --git a/src/tools/connection_patcher/Program.cpp b/src/tools/connection_patcher/Program.cpp index 949365b54ee..a5c22cdfc24 100644 --- a/src/tools/connection_patcher/Program.cpp +++ b/src/tools/connection_patcher/Program.cpp @@ -79,6 +79,10 @@ namespace Connection_Patcher std::vector<unsigned char> verVec(verPatch.begin(), verPatch.end()); patcher->Patch(verVec, Patterns::Common::VersionsFile()); + std::cout << "patching launcher login parameters location\n"; + // change registry/CFPreferences path + patcher->Patch(Patches::Common::LauncherLoginParametersLocation(), Patterns::Common::LauncherLoginParametersLocation()); + patcher->Finish(output); std::cout << "Patching done.\n"; |