mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7046] Do more security level checks in commands using HasLowerSecurity. Make use .account set addon safe for players.
This commit is contained in:
parent
d12944d8f2
commit
cc5fc88fb2
7 changed files with 66 additions and 92 deletions
|
|
@ -86,27 +86,11 @@ bool ChatHandler::HandleMuteCommand(const char* args)
|
|||
|
||||
Player *chr = objmgr.GetPlayer(guid);
|
||||
|
||||
// check security
|
||||
uint32 account_id = 0;
|
||||
uint32 security = 0;
|
||||
|
||||
if (chr)
|
||||
{
|
||||
account_id = chr->GetSession()->GetAccountId();
|
||||
security = chr->GetSession()->GetSecurity();
|
||||
}
|
||||
else
|
||||
{
|
||||
account_id = objmgr.GetPlayerAccountIdByGUID(guid);
|
||||
security = accmgr.GetSecurity(account_id);
|
||||
}
|
||||
|
||||
if(m_session && security >= m_session->GetSecurity())
|
||||
{
|
||||
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||
SetSentErrorMessage(true);
|
||||
// must have strong lesser security level
|
||||
if(HasLowerSecurity (chr,guid,true))
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 account_id = chr ? chr->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(guid);
|
||||
|
||||
time_t mutetime = time(NULL) + notspeaktime*60;
|
||||
|
||||
|
|
@ -152,27 +136,11 @@ bool ChatHandler::HandleUnmuteCommand(const char* args)
|
|||
|
||||
Player *chr = objmgr.GetPlayer(guid);
|
||||
|
||||
// check security
|
||||
uint32 account_id = 0;
|
||||
uint32 security = 0;
|
||||
|
||||
if (chr)
|
||||
{
|
||||
account_id = chr->GetSession()->GetAccountId();
|
||||
security = chr->GetSession()->GetSecurity();
|
||||
}
|
||||
else
|
||||
{
|
||||
account_id = objmgr.GetPlayerAccountIdByGUID(guid);
|
||||
security = accmgr.GetSecurity(account_id);
|
||||
}
|
||||
|
||||
if(m_session && security >= m_session->GetSecurity())
|
||||
{
|
||||
SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||
SetSentErrorMessage(true);
|
||||
// must have strong lesser security level
|
||||
if(HasLowerSecurity (chr,guid,true))
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 account_id = chr ? chr->GetSession()->GetAccountId() : objmgr.GetPlayerAccountIdByGUID(guid);
|
||||
|
||||
if (chr)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue