mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Log: Log all character kicks to "network.kick" category
(cherry picked from commit 31018c3652)
This commit is contained in:
@@ -112,8 +112,8 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accountId)
|
||||
if (Player* p = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
{
|
||||
WorldSession* s = p->GetSession();
|
||||
s->KickPlayer(); // mark session to remove at next session list update
|
||||
s->LogoutPlayer(false); // logout player without waiting next session list update
|
||||
s->KickPlayer("AccountMgr::DeleteAccount Deleting the account"); // mark session to remove at next session list update
|
||||
s->LogoutPlayer(false); // logout player without waiting next session list update
|
||||
}
|
||||
|
||||
Player::DeleteFromDB(guid, accountId, false); // no need to update realm characters
|
||||
|
||||
@@ -972,7 +972,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPackets::Character::PlayerLogin&
|
||||
if (PlayerLoading() || GetPlayer() != nullptr)
|
||||
{
|
||||
TC_LOG_ERROR("network", "Player tries to login again, AccountId = %d", GetAccountId());
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::HandlePlayerLoginOpcode Another client logging in");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -983,7 +983,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPackets::Character::PlayerLogin&
|
||||
if (!IsLegitCharacterForAccount(playerLogin.Guid))
|
||||
{
|
||||
TC_LOG_ERROR("network", "Account (%u) can't login with that character (%s).", GetAccountId(), playerLogin.Guid.ToString().c_str());
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::HandlePlayerLoginOpcode Trying to login with a character of another account");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -994,7 +994,7 @@ void WorldSession::HandleContinuePlayerLogin()
|
||||
{
|
||||
if (!PlayerLoading() || GetPlayer())
|
||||
{
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::HandleContinuePlayerLogin incorrect player state when logging in");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1015,7 +1015,7 @@ void WorldSession::AbortLogin(WorldPackets::Character::LoginFailureReason reason
|
||||
{
|
||||
if (!PlayerLoading() || GetPlayer())
|
||||
{
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::AbortLogin incorrect player state when logging in");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1040,7 +1040,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||
if (!pCurrChar->LoadFromDB(playerGuid, holder))
|
||||
{
|
||||
SetPlayer(nullptr);
|
||||
KickPlayer(); // disconnect client, player no set to session and it will not deleted or saved at kick
|
||||
KickPlayer("WorldSession::HandlePlayerLogin Player::LoadFromDB failed"); // disconnect client, player no set to session and it will not deleted or saved at kick
|
||||
delete pCurrChar; // delete it manually
|
||||
delete holder; // delete all unprocessed queries
|
||||
m_playerLoading.Clear();
|
||||
@@ -1538,7 +1538,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPackets::Character::CharacterRena
|
||||
{
|
||||
TC_LOG_ERROR("network", "Account %u, IP: %s tried to rename character %s, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), request.RenameInfo->Guid.ToString().c_str());
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::HandleCharRenameOpcode rename character from a different account");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1736,7 +1736,7 @@ void WorldSession::HandleCharCustomizeOpcode(WorldPackets::Character::CharCustom
|
||||
{
|
||||
TC_LOG_ERROR("entities.player.cheat", "Account %u, IP: %s tried to customise %s, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), packet.CustomizeInfo->CharGUID.ToString().c_str());
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::HandleCharCustomize Trying to customise character of another account");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2011,7 +2011,7 @@ void WorldSession::HandleCharRaceOrFactionChangeOpcode(WorldPackets::Character::
|
||||
{
|
||||
TC_LOG_ERROR("entities.player.cheat", "Account %u, IP: %s tried to factionchange character %s, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), packet.RaceOrFactionChangeInfo->Guid.ToString().c_str());
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::HandleCharFactionOrRaceChange Trying to change faction of character of another account");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -521,7 +521,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPackets::Movement::MovementSpe
|
||||
{
|
||||
TC_LOG_DEBUG("misc", "Player %s from account id %u kicked for incorrect speed (must be %f instead %f)",
|
||||
_player->GetName().c_str(), _player->GetSession()->GetAccountId(), _player->GetSpeed(move_type), packet.Speed);
|
||||
_player->GetSession()->KickPlayer();
|
||||
_player->GetSession()->KickPlayer("WorldSession::HandleForceSpeedChangeAck Incorrect speed");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -637,7 +637,7 @@ void WorldSession::HandleMoveSetModMovementForceMagnitudeAck(WorldPackets::Movem
|
||||
{
|
||||
TC_LOG_DEBUG("misc", "Player %s from account id %u kicked for incorrect movement force magnitude (must be %f instead %f)",
|
||||
_player->GetName().c_str(), _player->GetSession()->GetAccountId(), expectedModMagnitude, setModMovementForceMagnitudeAck.Speed);
|
||||
_player->GetSession()->KickPlayer();
|
||||
_player->GetSession()->KickPlayer("WorldSession::HandleMoveSetModMovementForceMagnitudeAck Incorrect magnitude");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), ihe.GetInvalidValue().c_str());
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::Update Invalid chat link");
|
||||
}
|
||||
catch (WorldPackets::IllegalHyperlinkException const& ihe)
|
||||
{
|
||||
@@ -439,7 +439,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
GetOpcodeNameForLogging(static_cast<OpcodeClient>(packet->GetOpcode())).c_str(), ihe.GetInvalidValue().c_str());
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::Update Illegal chat link");
|
||||
}
|
||||
catch (WorldPackets::PacketArrayMaxCapacityException const& pamce)
|
||||
{
|
||||
@@ -679,8 +679,11 @@ void WorldSession::LogoutPlayer(bool save)
|
||||
}
|
||||
|
||||
/// Kick a player out of the World
|
||||
void WorldSession::KickPlayer()
|
||||
void WorldSession::KickPlayer(std::string const& reason)
|
||||
{
|
||||
TC_LOG_INFO("network.kick", "Account: %u Character: '%s' %s kicked with reason: %s", GetAccountId(), _player ? _player->GetName().c_str() : "<none>",
|
||||
_player ? _player->GetGUID().ToString().c_str() : "", reason.c_str());
|
||||
|
||||
for (uint8 i = 0; i < 2; ++i)
|
||||
{
|
||||
if (m_Socket[i])
|
||||
@@ -700,7 +703,7 @@ bool WorldSession::ValidateHyperlinksAndMaybeKick(std::string const& str)
|
||||
GetPlayer()->GetGUID().ToString().c_str(), str.c_str());
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::ValidateHyperlinksAndMaybeKick Invalid chat link");
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -714,7 +717,7 @@ bool WorldSession::DisallowHyperlinksAndMaybeKick(std::string const& str)
|
||||
GetPlayer()->GetGUID().ToString().c_str(), str.c_str());
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer();
|
||||
KickPlayer("WorldSession::DisallowHyperlinksAndMaybeKick Illegal chat link");
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1246,7 +1249,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
case POLICY_KICK:
|
||||
{
|
||||
TC_LOG_WARN("network", "AntiDOS: Player kicked!");
|
||||
Session->KickPlayer();
|
||||
Session->KickPlayer("WorldSession::DosProtection::EvaluateOpcode AntiDOS");
|
||||
return false;
|
||||
}
|
||||
case POLICY_BAN:
|
||||
@@ -1262,7 +1265,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
|
||||
}
|
||||
sWorld->BanAccount(bm, nameOrIp, duration, "DOS (Packet Flooding/Spoofing", "Server: AutoDOS");
|
||||
TC_LOG_WARN("network", "AntiDOS: Player automatically banned for %u seconds.", duration);
|
||||
Session->KickPlayer();
|
||||
Session->KickPlayer("WorldSession::DosProtection::EvaluateOpcode AntiDOS");
|
||||
return false;
|
||||
}
|
||||
default: // invalid policy
|
||||
|
||||
@@ -1020,7 +1020,7 @@ class TC_GAME_API WorldSession
|
||||
}
|
||||
|
||||
void LogoutPlayer(bool save);
|
||||
void KickPlayer();
|
||||
void KickPlayer(std::string const& reason);
|
||||
// Returns true if all contained hyperlinks are valid
|
||||
// May kick player on false depending on world config (handler should abort)
|
||||
bool ValidateHyperlinksAndMaybeKick(std::string const& str);
|
||||
|
||||
@@ -111,7 +111,7 @@ void Warden::Update()
|
||||
{
|
||||
TC_LOG_WARN("warden", "%s (latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client",
|
||||
_session->GetPlayerInfo().c_str(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, TimeFormat::ShortText).c_str());
|
||||
_session->KickPlayer();
|
||||
_session->KickPlayer("Warden::Update Warden module response delay exceeded");
|
||||
}
|
||||
else
|
||||
_clientResponseTimer += diff;
|
||||
@@ -196,7 +196,7 @@ std::string Warden::Penalty(WardenCheck* check /*= nullptr*/)
|
||||
return "None";
|
||||
break;
|
||||
case WARDEN_ACTION_KICK:
|
||||
_session->KickPlayer();
|
||||
_session->KickPlayer("Warden::Penalty");
|
||||
return "Kick";
|
||||
break;
|
||||
case WARDEN_ACTION_BAN:
|
||||
|
||||
@@ -265,5 +265,5 @@ void WardenMac::HandleData(ByteBuffer &buff)
|
||||
//found = true;
|
||||
}
|
||||
|
||||
_session->KickPlayer();
|
||||
_session->KickPlayer("WardenMac::HandleData");
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ bool World::RemoveSession(uint32 id)
|
||||
if (itr->second->PlayerLoading())
|
||||
return false;
|
||||
|
||||
itr->second->KickPlayer();
|
||||
itr->second->KickPlayer("World::RemoveSession");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -353,9 +353,9 @@ void World::AddSession_(WorldSession* s)
|
||||
|
||||
///- kick already loaded player with same account (if any) and remove session
|
||||
///- if player is in loading and want to load again, return
|
||||
if (!RemoveSession (s->GetAccountId()))
|
||||
if (!RemoveSession(s->GetAccountId()))
|
||||
{
|
||||
s->KickPlayer();
|
||||
s->KickPlayer("World::AddSession_ Couldn't remove the other session while on loading screen");
|
||||
delete s; // session not added yet in session list, so not listed in queue
|
||||
return;
|
||||
}
|
||||
@@ -2975,7 +2975,7 @@ void World::KickAll()
|
||||
|
||||
// session not removed at kick and will removed in next update tick
|
||||
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
itr->second->KickPlayer();
|
||||
itr->second->KickPlayer("World::KickAll");
|
||||
}
|
||||
|
||||
/// Kick (and save) all players with security level less `sec`
|
||||
@@ -2984,7 +2984,7 @@ void World::KickAllLess(AccountTypes sec)
|
||||
// session not removed at kick and will removed in next update tick
|
||||
for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
|
||||
if (itr->second->GetSecurity() < sec)
|
||||
itr->second->KickPlayer();
|
||||
itr->second->KickPlayer("World::KickAllLess");
|
||||
}
|
||||
|
||||
/// Ban an account or ban an IP address, duration will be parsed using TimeStringToSecs if it is positive, otherwise permban
|
||||
@@ -3072,7 +3072,7 @@ BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, uint32 du
|
||||
|
||||
if (WorldSession* sess = FindSession(account))
|
||||
if (std::string(sess->GetPlayerName()) != author)
|
||||
sess->KickPlayer();
|
||||
sess->KickPlayer("World::BanAccount Banning account");
|
||||
} while (resultAccounts->NextRow());
|
||||
|
||||
LoginDatabase.CommitTransaction(trans);
|
||||
@@ -3143,7 +3143,7 @@ BanReturn World::BanCharacter(std::string const& name, std::string const& durati
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
if (banned)
|
||||
banned->GetSession()->KickPlayer();
|
||||
banned->GetSession()->KickPlayer("World::BanCharacter Banning character");
|
||||
|
||||
return BAN_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ public:
|
||||
target->SetName(newName);
|
||||
|
||||
if (WorldSession* session = target->GetSession())
|
||||
session->KickPlayer();
|
||||
session->KickPlayer("HandleCharacterRenameCommand GM Command renaming character");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -861,7 +861,7 @@ public:
|
||||
{
|
||||
characterGuid = player->GetGUID();
|
||||
accountId = player->GetSession()->GetAccountId();
|
||||
player->GetSession()->KickPlayer();
|
||||
player->GetSession()->KickPlayer("HandleCharacterEraseCommand GM Command deleting character");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -953,7 +953,7 @@ public:
|
||||
else
|
||||
handler->PSendSysMessage(LANG_COMMAND_KICKMESSAGE, playerName.c_str());
|
||||
|
||||
target->GetSession()->KickPlayer();
|
||||
target->GetSession()->KickPlayer("HandleKickPlayerCommand GM Command");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4098,6 +4098,7 @@ Logger.mmaps=3,Server
|
||||
#Logger.movement.motionmaster=3,Console Server
|
||||
#Logger.movement.splinechain=3,Console Server
|
||||
#Logger.network=3,Console Server
|
||||
#Logger.network.kick=3,Console Server
|
||||
#Logger.network.opcode=3,Console Server
|
||||
#Logger.network.soap=3,Console Server
|
||||
#Logger.outdoorpvp=3,Console Server
|
||||
|
||||
Reference in New Issue
Block a user