Core/Log: Log all character kicks to "network.kick" category

(cherry picked from commit 31018c36527755166d8a297ac9e6c98a66f014ae)
This commit is contained in:
jackpoz
2022-01-01 12:56:24 +01:00
committed by Shauren
parent dbb0f399fa
commit 68d947d42f
11 changed files with 37 additions and 33 deletions
+10 -7
View File
@@ -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