Core/DBLayer: Prevent using prepared statements on wrong database
This commit is contained in:
1 parent
eaee7b3cfa
commit
d003ebd8e4
98 files changed
+569
-541
No files matched your search
@@ -88,7 +88,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
|
||||
|
||||
stmt->setUInt8(0, expansion);
|
||||
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
static bool HandleAccountOnlineListCommand(ChatHandler* handler)
|
||||
{
|
||||
///- Get the list of accounts ID logged to the realm
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ONLINE);
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ONLINE);
|
||||
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
@@ -222,9 +222,9 @@ public:
|
||||
|
||||
///- Get the username, last IP and GM level of each account
|
||||
// No SQL injection. account is uint32.
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO);
|
||||
stmt->setUInt32(0, account);
|
||||
PreparedQueryResult resultLogin = LoginDatabase.Query(stmt);
|
||||
LoginDatabasePreparedStatement* loginStmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO);
|
||||
loginStmt->setUInt32(0, account);
|
||||
PreparedQueryResult resultLogin = LoginDatabase.Query(loginStmt);
|
||||
|
||||
if (resultLogin)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ public:
|
||||
{
|
||||
if (IpLocationRecord const* location = sIPLocation->GetLocationRecord(handler->GetSession()->GetRemoteAddress()))
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_COUNTRY);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_COUNTRY);
|
||||
stmt->setString(0, location->CountryCode);
|
||||
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
||||
LoginDatabase.Execute(stmt);
|
||||
@@ -264,7 +264,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_COUNTRY);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_COUNTRY);
|
||||
stmt->setString(0, "00");
|
||||
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
||||
LoginDatabase.Execute(stmt);
|
||||
@@ -275,7 +275,7 @@ public:
|
||||
|
||||
static bool HandleAccountLockIpCommand(ChatHandler* handler, bool state)
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK);
|
||||
|
||||
if (state)
|
||||
{
|
||||
@@ -457,7 +457,7 @@ public:
|
||||
std::string emailoutput;
|
||||
uint32 accountId = handler->GetSession()->GetAccountId();
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_EMAIL_BY_ID);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_EMAIL_BY_ID);
|
||||
stmt->setUInt32(0, accountId);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
|
||||
@@ -513,7 +513,7 @@ public:
|
||||
if (expansion > sWorld->getIntConfig(CONFIG_EXPANSION))
|
||||
return false;
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
|
||||
|
||||
stmt->setUInt8(0, expansion);
|
||||
stmt->setUInt32(1, accountId);
|
||||
@@ -573,7 +573,7 @@ public:
|
||||
// Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1
|
||||
if (realmId == -1 && !AccountMgr::IsConsoleAccount(playerSecurity))
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST);
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST);
|
||||
|
||||
stmt->setUInt32(0, accountId);
|
||||
stmt->setUInt8(1, gmLevel);
|
||||
|
||||
Reference in new issue
Block a user