aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp25
-rw-r--r--src/server/game/Server/WorldSession.h6
2 files changed, 24 insertions, 7 deletions
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 1e6dfa8c94c..02d4d1b1a25 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -215,7 +215,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
data << num;
- _allowedCharsToLogin.clear();
+ _legitCharacters.clear();
if (result)
{
do
@@ -224,7 +224,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
sLog->outInfo(LOG_FILTER_NETWORKIO, "Loading char guid %u from account %u.", guidlow, GetAccountId());
if (Player::BuildEnumData(result, &data))
{
- _allowedCharsToLogin.insert(guidlow);
+ _legitCharacters.insert(guidlow);
if (!sWorld->HasCharacterNameData(guidlow)) // This can happen if characters are inserted into the database manually. Core hasn't loaded name data yet.
sWorld->AddCharacterNameData(guidlow, (*result)[1].GetString(), (*result)[4].GetUInt8(), (*result)[2].GetUInt8(), (*result)[3].GetUInt8(), (*result)[7].GetUInt8());
++num;
@@ -759,7 +759,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
recvData >> playerGuid;
- if (!CharCanLogin(GUID_LOPART(playerGuid)))
+ if (!IsLegitCharacterForAccount(GUID_LOPART(playerGuid)))
{
sLog->outError(LOG_FILTER_NETWORKIO, "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
KickPlayer();
@@ -1386,6 +1386,14 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
std::string newName;
recvData >> guid;
+ if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
+ {
+ sLog->outError(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!",
+ GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
+ recvData.rfinish();
+ KickPlayer();
+ }
+
recvData >> newName;
uint8 gender, skin, face, hairStyle, hairColor, facialHair;
@@ -1394,7 +1402,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN);
stmt->setUInt32(0, GUID_LOPART(guid));
-
+ // TODO: Make async with callback
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
@@ -1619,6 +1627,15 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
std::string newname;
uint8 gender, skin, face, hairStyle, hairColor, facialHair, race;
recvData >> guid;
+
+ if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
+ {
+ sLog->outError(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!",
+ GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
+ recvData.rfinish();
+ KickPlayer();
+ }
+
recvData >> newname;
recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race;
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index d6877b8a18a..c1d7f0b00db 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -919,14 +919,14 @@ class WorldSession
void LogUnprocessedTail(WorldPacket* packet);
// EnumData helpers
- bool CharCanLogin(uint32 lowGUID)
+ bool IsLegitCharacterForAccount(uint32 lowGUID)
{
- return _allowedCharsToLogin.find(lowGUID) != _allowedCharsToLogin.end();
+ return _legitCharacters.find(lowGUID) != _legitCharacters.end();
}
// this stores the GUIDs of the characters who can login
// characters who failed on Player::BuildEnumData shouldn't login
- std::set<uint32> _allowedCharsToLogin;
+ std::set<uint32> _legitCharacters;
uint32 m_GUIDLow; // set loggined or recently logout player (while m_playerRecentlyLogout set)
Player* _player;