diff options
author | Shauren <shauren.trinity@gmail.com> | 2019-07-27 01:00:37 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-07-27 01:00:37 +0200 |
commit | e8e89f58fb800014f53341f12505f60ee2b5fb6f (patch) | |
tree | 2b63800163e2026be75621a36ddf1218bdbf9dab /src/server/game/Accounts/BattlenetAccountMgr.cpp | |
parent | 1dcbceba81002ba6ff83129d403763df398f9736 (diff) |
Core/DBLayer: Prevent using prepared statements on wrong database
Diffstat (limited to 'src/server/game/Accounts/BattlenetAccountMgr.cpp')
-rw-r--r-- | src/server/game/Accounts/BattlenetAccountMgr.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/server/game/Accounts/BattlenetAccountMgr.cpp b/src/server/game/Accounts/BattlenetAccountMgr.cpp index 6096a74cd8c..f66b018a8ec 100644 --- a/src/server/game/Accounts/BattlenetAccountMgr.cpp +++ b/src/server/game/Accounts/BattlenetAccountMgr.cpp @@ -37,7 +37,7 @@ AccountOpResult Battlenet::AccountMgr::CreateBattlenetAccount(std::string email, if (GetId(email)) return AccountOpResult::AOR_NAME_ALREADY_EXIST; - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_BNET_ACCOUNT); + LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_BNET_ACCOUNT); stmt->setString(0, email); stmt->setString(1, CalculateShaPassHash(email, password)); LoginDatabase.DirectExecute(stmt); @@ -65,7 +65,7 @@ AccountOpResult Battlenet::AccountMgr::ChangePassword(uint32 accountId, std::str if (utf8length(newPassword) > MAX_PASS_STR) return AccountOpResult::AOR_PASS_TOO_LONG; - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_PASSWORD); + LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_PASSWORD); stmt->setString(0, CalculateShaPassHash(username, newPassword)); stmt->setUInt32(1, accountId); LoginDatabase.Execute(stmt); @@ -83,7 +83,7 @@ bool Battlenet::AccountMgr::CheckPassword(uint32 accountId, std::string password Utf8ToUpperOnlyLatin(username); Utf8ToUpperOnlyLatin(password); - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_CHECK_PASSWORD); + LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_CHECK_PASSWORD); stmt->setUInt32(0, accountId); stmt->setString(1, CalculateShaPassHash(username, password)); @@ -103,7 +103,7 @@ AccountOpResult Battlenet::AccountMgr::LinkWithGameAccount(std::string const& em if (GetIdByGameAccount(gameAccountId)) return AccountOpResult::AOR_ACCOUNT_BAD_LINK; - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_GAME_ACCOUNT_LINK); + LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_GAME_ACCOUNT_LINK); stmt->setUInt32(0, bnetAccountId); stmt->setUInt8(1, GetMaxIndex(bnetAccountId) + 1); stmt->setUInt32(2, gameAccountId); @@ -120,7 +120,7 @@ AccountOpResult Battlenet::AccountMgr::UnlinkGameAccount(std::string const& game if (!GetIdByGameAccount(gameAccountId)) return AccountOpResult::AOR_ACCOUNT_BAD_LINK; - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_GAME_ACCOUNT_LINK); + LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_GAME_ACCOUNT_LINK); stmt->setNull(0); stmt->setNull(1); stmt->setUInt32(2, gameAccountId); @@ -130,7 +130,7 @@ AccountOpResult Battlenet::AccountMgr::UnlinkGameAccount(std::string const& game uint32 Battlenet::AccountMgr::GetId(std::string const& username) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ACCOUNT_ID_BY_EMAIL); + LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ACCOUNT_ID_BY_EMAIL); stmt->setString(0, username); if (PreparedQueryResult result = LoginDatabase.Query(stmt)) return (*result)[0].GetUInt32(); @@ -140,7 +140,7 @@ uint32 Battlenet::AccountMgr::GetId(std::string const& username) bool Battlenet::AccountMgr::GetName(uint32 accountId, std::string& name) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ACCOUNT_EMAIL_BY_ID); + LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ACCOUNT_EMAIL_BY_ID); stmt->setUInt32(0, accountId); if (PreparedQueryResult result = LoginDatabase.Query(stmt)) { @@ -153,7 +153,7 @@ bool Battlenet::AccountMgr::GetName(uint32 accountId, std::string& name) uint32 Battlenet::AccountMgr::GetIdByGameAccount(uint32 gameAccountId) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ACCOUNT_ID_BY_GAME_ACCOUNT); + LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ACCOUNT_ID_BY_GAME_ACCOUNT); stmt->setUInt32(0, gameAccountId); if (PreparedQueryResult result = LoginDatabase.Query(stmt)) return (*result)[0].GetUInt32(); @@ -163,7 +163,7 @@ uint32 Battlenet::AccountMgr::GetIdByGameAccount(uint32 gameAccountId) uint8 Battlenet::AccountMgr::GetMaxIndex(uint32 accountId) { - PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_MAX_ACCOUNT_INDEX); + LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_MAX_ACCOUNT_INDEX); stmt->setUInt32(0, accountId); PreparedQueryResult result = LoginDatabase.Query(stmt); if (result) |