Fix a login exploit.

Make a list of GUIDs that purpose is which characters can login per account.
This fixes an exploit that player can login (but shouldn't) with packet manipulation.

Signed-off-by: Anubisss <[email protected]>
This commit is contained in:
Anubisss
2011-04-01 03:11:57 +02:00
parent 24dae7dd9a
commit 5fe6c225e2
2 changed files with 23 additions and 0 deletions
@@ -212,7 +212,10 @@ void WorldSession::HandleCharEnum(QueryResult result)
uint32 guidlow = (*result)[0].GetUInt32(); uint32 guidlow = (*result)[0].GetUInt32();
sLog->outDetail("Loading char guid %u from account %u.",guidlow,GetAccountId()); sLog->outDetail("Loading char guid %u from account %u.",guidlow,GetAccountId());
if (Player::BuildEnumData(result, &data)) if (Player::BuildEnumData(result, &data))
{
m_AllowedCharsToLogin.push_back(guidlow);
++num; ++num;
}
} }
while (result->NextRow()); while (result->NextRow());
} }
@@ -660,6 +663,13 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recv_data)
recv_data >> playerGuid; recv_data >> playerGuid;
if (!CharCanLogin(GUID_LOPART(playerGuid)))
{
sLog->outError("Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
KickPlayer();
return;
}
LoginQueryHolder *holder = new LoginQueryHolder(GetAccountId(), playerGuid); LoginQueryHolder *holder = new LoginQueryHolder(GetAccountId(), playerGuid);
if (!holder->Initialize()) if (!holder->Initialize())
{ {
+13
View File
@@ -882,6 +882,19 @@ class WorldSession
void LogUnexpectedOpcode(WorldPacket *packet, const char* status, const char *reason); void LogUnexpectedOpcode(WorldPacket *packet, const char* status, const char *reason);
void LogUnprocessedTail(WorldPacket *packet); void LogUnprocessedTail(WorldPacket *packet);
// EnumData helpers
bool CharCanLogin(uint32 LowGUID)
{
if (find(m_AllowedCharsToLogin.begin(),
m_AllowedCharsToLogin.end(),
LowGUID) == m_AllowedCharsToLogin.end())
return false;
return true;
}
// this stores the GUIDs of the characters who can login
// characters who failed on Player::BuildEnumData shouldn't login
std::list<uint32> m_AllowedCharsToLogin;
uint32 m_GUIDLow; // set loggined or recently logout player (while m_playerRecentlyLogout set) uint32 m_GUIDLow; // set loggined or recently logout player (while m_playerRecentlyLogout set)
Player *_player; Player *_player;
WorldSocket *m_Socket; WorldSocket *m_Socket;