diff options
| author | Shauren <shauren.trinity@gmail.com> | 2014-08-22 20:09:18 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2014-08-22 20:09:18 +0200 |
| commit | b90329d63acaecb1f074dd2b303561baa9f639a2 (patch) | |
| tree | f2adfc5acec51b4467d56ba1a659330e83fb5aff /src/server/game | |
| parent | f2cb5061618367d6d4c07dee40eb9c6ecaed5d03 (diff) | |
Core/Battle.net: Use real account name from account table to auth instead of always constructing bnetId#index. Fixes having to reconfigure addons by players.
*NEW* battle.net only accounts should be created with battlenet_account_id#account_index format in username
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/Accounts/BattlenetAccountMgr.cpp | 23 | ||||
| -rw-r--r-- | src/server/game/Accounts/BattlenetAccountMgr.h | 1 | ||||
| -rw-r--r-- | src/server/game/Server/WorldSocket.cpp | 36 |
3 files changed, 10 insertions, 50 deletions
diff --git a/src/server/game/Accounts/BattlenetAccountMgr.cpp b/src/server/game/Accounts/BattlenetAccountMgr.cpp index 23c1b7cdd61..da71f02d7d2 100644 --- a/src/server/game/Accounts/BattlenetAccountMgr.cpp +++ b/src/server/game/Accounts/BattlenetAccountMgr.cpp @@ -126,26 +126,3 @@ std::string Battlenet::AccountMgr::CalculateShaPassHash(std::string const& name, return ByteArrayToHexStr(sha.GetDigest(), sha.GetLength(), true); } - -bool Battlenet::AccountMgr::GetAccountIdAndIndex(std::string const& account, uint32* battlenetAccountId, uint8* battlenetAccountIndex) -{ - Tokenizer tokens(account, '#'); - if (tokens.size() != 2) - return false; - - if (!battlenetAccountId) - return false; - - *battlenetAccountId = atol(tokens[0]); - if (!*battlenetAccountId) - return false; - - if (battlenetAccountIndex) - { - *battlenetAccountIndex = atol(tokens[1]); - if (!*battlenetAccountIndex) - return false; - } - - return true; -} diff --git a/src/server/game/Accounts/BattlenetAccountMgr.h b/src/server/game/Accounts/BattlenetAccountMgr.h index c41a54189e5..1e0b7b78a99 100644 --- a/src/server/game/Accounts/BattlenetAccountMgr.h +++ b/src/server/game/Accounts/BattlenetAccountMgr.h @@ -38,7 +38,6 @@ namespace Battlenet uint32 GetIdByGameAccount(uint32 gameAccountId); std::string CalculateShaPassHash(std::string const& name, std::string const& password); - bool GetAccountIdAndIndex(std::string const& account, uint32* battlenetAccountId, uint8* battlenetAccountIndex); } } diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index df1a072b81d..9a7b212da04 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -261,31 +261,10 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket) account = recvPacket.ReadString(accountNameLength); // Get the account information from the auth database - // 0 1 2 3 4 5 6 7 8 - // SELECT id, sessionkey, last_ip, locked, expansion, mutetime, locale, recruiter, os FROM account WHERE username = ? - PreparedStatement* stmt; - uint32 battlenetAccountId = 0; - uint8 battlenetAccountIndex = 0; - if (loginServerType == 1) - { - if (!Battlenet::AccountMgr::GetAccountIdAndIndex(account, &battlenetAccountId, &battlenetAccountIndex)) - { - // We can not log here, as we do not know the account. Thus, no accountId. - SendAuthResponseError(AUTH_UNKNOWN_ACCOUNT); - TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); - DelayedCloseSocket(); - return; - } - - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO_BY_BNET); - stmt->setUInt32(0, battlenetAccountId); - stmt->setUInt8(1, battlenetAccountIndex); - } - else - { - stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME); - stmt->setString(0, account); - } + // 0 1 2 3 4 5 6 7 8 9 + // SELECT id, sessionkey, last_ip, locked, expansion, mutetime, locale, recruiter, os, battlenet_account FROM account WHERE username = ? + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO_BY_NAME); + stmt->setString(0, account); PreparedQueryResult result = LoginDatabase.Query(stmt); @@ -392,7 +371,7 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket) { mutetime = time(NULL) + llabs(mutetime); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN); stmt->setInt64(0, mutetime); stmt->setUInt32(1, id); @@ -405,6 +384,11 @@ void WorldSocket::HandleAuthSession(WorldPacket& recvPacket) locale = LOCALE_enUS; uint32 recruiter = fields[7].GetUInt32(); + + uint32 battlenetAccountId = 0; + if (loginServerType == 1) + battlenetAccountId = fields[9].GetUInt32(); + // Checks gmlevel per Realm stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID); |
