Core/DBLayer: Prevent using prepared statements on wrong database

This commit is contained in:
Shauren
2019-07-27 01:00:37 +02:00
parent 1dcbceba81
commit e8e89f58fb
102 changed files with 604 additions and 577 deletions

View File

@@ -91,7 +91,7 @@ void Battlenet::Session::Start()
// Verify that this IP is not in the ip_banned table
LoginDatabase.Execute(LoginDatabase.GetPreparedStatement(LOGIN_DEL_EXPIRED_IP_BANS));
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_INFO);
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP_INFO);
stmt->setString(0, ip_address);
_queryProcessor.AddQuery(LoginDatabase.AsyncQuery(stmt).WithPreparedCallback(std::bind(&Battlenet::Session::CheckIpCallback, this, std::placeholders::_1)));
@@ -253,7 +253,7 @@ uint32 Battlenet::Session::VerifyWebCredentials(std::string const& webCredential
if (webCredentials.empty())
return ERROR_DENIED;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ACCOUNT_INFO);
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_ACCOUNT_INFO);
stmt->setString(0, webCredentials);
std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)> asyncContinuation = std::move(continuation);
@@ -276,7 +276,7 @@ uint32 Battlenet::Session::VerifyWebCredentials(std::string const& webCredential
return;
}
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_CHARACTER_COUNTS_BY_BNET_ID);
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_CHARACTER_COUNTS_BY_BNET_ID);
stmt->setUInt32(0, accountInfo->Id);
callback.SetNextQuery(LoginDatabase.AsyncQuery(stmt));
})
@@ -293,7 +293,7 @@ uint32 Battlenet::Session::VerifyWebCredentials(std::string const& webCredential
} while (characterCountsResult->NextRow());
}
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_LAST_PLAYER_CHARACTERS);
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_LAST_PLAYER_CHARACTERS);
stmt->setUInt32(0, accountInfo->Id);
callback.SetNextQuery(LoginDatabase.AsyncQuery(stmt));
})
@@ -536,7 +536,7 @@ uint32 Battlenet::Session::GetRealmListTicket(std::unordered_map<std::string, Va
if (!clientInfoOk)
return ERROR_WOW_SERVICES_DENIED_REALM_LIST_TICKET;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_LAST_LOGIN_INFO);
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_BNET_LAST_LOGIN_INFO);
stmt->setString(0, GetRemoteIpAddress().to_string());
stmt->setUInt8(1, GetLocaleByName(_locale));
stmt->setString(2, _os);