mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[8424] Added support for strict chatmessage validation
This commit is contained in:
parent
3c22e14e53
commit
43a4d1505e
13 changed files with 631 additions and 39 deletions
|
|
@ -37,6 +37,28 @@
|
|||
#include "GridNotifiersImpl.h"
|
||||
#include "CellImpl.h"
|
||||
|
||||
bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg, uint32 lang)
|
||||
{
|
||||
if (lang != LANG_ADDON)
|
||||
{
|
||||
// strip invisible characters for non-addon messages
|
||||
if(sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
|
||||
if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR
|
||||
&& !ChatHandler(this).isValidChatMessage(msg.c_str()))
|
||||
{
|
||||
sLog.outError("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(),
|
||||
GetPlayer()->GetGUIDLow(), msg.c_str());
|
||||
if (sWorld.getConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
||||
{
|
||||
uint32 type;
|
||||
|
|
@ -150,9 +172,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
|
||||
break;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
@ -171,9 +192,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
recv_data >> to;
|
||||
recv_data >> msg;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
@ -224,9 +244,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
|
||||
break;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
@ -253,9 +272,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
|
||||
break;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
@ -280,9 +298,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
|
||||
break;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
@ -306,9 +323,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
|
||||
break;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
@ -334,9 +350,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
if (ChatHandler(this).ParseCommands(msg.c_str()) > 0)
|
||||
break;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
@ -355,9 +370,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
std::string msg="";
|
||||
recv_data >> msg;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
@ -377,9 +391,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
std::string msg="";
|
||||
recv_data >> msg;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
@ -399,9 +412,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
std::string msg="";
|
||||
recv_data >> msg;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
@ -423,9 +435,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
|
|||
|
||||
recv_data >> msg;
|
||||
|
||||
// strip invisible characters for non-addon messages
|
||||
if (lang != LANG_ADDON && sWorld.getConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING))
|
||||
stripLineInvisibleChars(msg);
|
||||
if (!processChatmessageFurtherAfterSecurityChecks(msg, lang))
|
||||
return;
|
||||
|
||||
if(msg.empty())
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue