Fix wrong group leader name in expedition requests

Get group leader name from Client if possible and ask database otherwise

Group::GetLeaderName() is unreliable and broken for groups formed across
zones. The correct leader name is needed here to avoid any possible
exploits with an invalid leader bypassing lockout checks.
This commit is contained in:
hg
2020-05-08 16:32:16 -04:00
parent 181973537c
commit 59cd45ec39
2 changed files with 10 additions and 1 deletions
+9 -1
View File
@@ -120,7 +120,8 @@ bool ExpeditionRequest::CanGroupRequest(Group* group)
{
m_leader = group->GetLeader()->CastToClient();
}
m_leader_name = group->GetLeaderName();
// Group::GetLeaderName() is broken if group formed across zones, ask database instead
m_leader_name = m_leader ? m_leader->GetName() : GetGroupLeaderName(group->GetID()); // group->GetLeaderName();
m_leader_id = m_leader ? m_leader->CharacterID() : database.GetCharacterID(m_leader_name.c_str());
uint32_t count = 0;
@@ -142,6 +143,13 @@ bool ExpeditionRequest::CanGroupRequest(Group* group)
return ValidateMembers(query_member_names, count);
}
std::string ExpeditionRequest::GetGroupLeaderName(uint32_t group_id)
{
char leader_name_buffer[64] = { 0 };
database.GetGroupLeadershipInfo(group_id, leader_name_buffer);
return std::string(leader_name_buffer);
}
bool ExpeditionRequest::ValidateMembers(const std::string& query_member_names, uint32_t member_count)
{
if (query_member_names.empty() || !LoadLeaderLockouts())