aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2020-04-08 21:05:01 +0200
committerShauren <shauren.trinity@gmail.com>2022-01-01 12:56:24 +0100
commit68d947d42f6b99b11bc59bb892b4e6602708dd07 (patch)
tree3f9fab655a5dcef9c2dea21386851978d7b57126 /src/server/game/Server
parentdbb0f399facbbaf5ada4cd90333475f6ecebc6ab (diff)
Core/Log: Log all character kicks to "network.kick" category
(cherry picked from commit 31018c36527755166d8a297ac9e6c98a66f014ae)
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/WorldSession.cpp17
-rw-r--r--src/server/game/Server/WorldSession.h2
2 files changed, 11 insertions, 8 deletions
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 95f3adfe184..f8bf5900fe6 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -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
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index b80248fcbb8..ccb140a7905 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -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);