aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2019-09-17 09:11:56 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-18 22:19:05 +0100
commit562c567b1e0c878f0632994a79bcfbfd4a962504 (patch)
treefe5d5e3045e649c9fda5cb9a98871fe0f193b757 /src/server/game/Server
parent368d99787cd8fff0e7831fbd2aafb122caea9b18 (diff)
Core/Calendar: Add some additional validation when creating events (#23797)
* Core/Calendar: Add some additional validation when creating events Allow only 30 player events and 100 guild events to be created. Don't allow to create guild events if player is not in guild. Send some more error messages to the client (not blizzlike errors but better than nothing). * Core/Calendar: Add some additional validation/checks Add guild id check in GetPlayerEvents(). Change error message in HandleCalendarCopyEvent() to be the same as in HandleCalendarAddEvent() when creating an event in the past. * Core/Calendar: Add some additional validation/checks Reduce the number of CMSG_CALENDAR_ADD_EVENT packets a seconds allowed from 10 to 3. * Core/Calendar: Add some additional validation/checks Implement 5 seconds cooldown between the creation of calendar events * Core/Calendar: Add some additional validation/checks Don't allow to copy events of a different player/guild * Core/Calendar: Implement automatic deletion of old events Implement automatic deletion of events older than 1 month (30 days). Fix debug assertion triggered when deleting a character with calendar events. Avoid double std::set lookup when deleting events when deleting a character. NB: The whole CalendarMgr/CalendarHandler code should be checked line by line for bugs/crashes/exploits. (cherry picked from commit fb059722fdb18a94d47b3f44a5b2d7f183bf5a29)
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/WorldSession.cpp8
-rw-r--r--src/server/game/Server/WorldSession.h8
2 files changed, 11 insertions, 5 deletions
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 84d9ef9ff86..6fac054eea5 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -139,14 +139,14 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun
_timeSyncClockDeltaQueue(6),
_timeSyncClockDelta(0),
_pendingTimeSyncRequests(),
+ _timeSyncNextCounter(0),
+ _timeSyncTimer(0),
+ _calendarEventCreationCooldown(0),
_battlePetMgr(std::make_unique<BattlePets::BattlePetMgr>(this)),
_collectionMgr(std::make_unique<CollectionMgr>(this))
{
memset(_tutorials, 0, sizeof(_tutorials));
- _timeSyncNextCounter = 0;
- _timeSyncTimer = 0;
-
if (sock)
{
m_Address = sock->GetRemoteIpAddress().to_string();
@@ -1389,7 +1389,6 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
case CMSG_SET_PARTY_LEADER: // 1 2 1 async db query
case CMSG_CONVERT_RAID: // 1 5 1 async db query
case CMSG_SET_ASSISTANT_LEADER: // 1 2 1 async db query
- case CMSG_CALENDAR_ADD_EVENT: // 21 10 2 async db query
case CMSG_MOVE_CHANGE_VEHICLE_SEATS: // not profiled
case CMSG_PETITION_BUY: // not profiled 1 sync 1 async db queries
case CMSG_REQUEST_VEHICLE_PREV_SEAT: // not profiled
@@ -1411,6 +1410,7 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
case CMSG_ENUM_CHARACTERS_DELETED_BY_CLIENT: // 22 3 2 async db queries
case CMSG_SUBMIT_USER_FEEDBACK: // not profiled 1 async db query
case CMSG_SUPPORT_TICKET_SUBMIT_COMPLAINT: // not profiled 1 async db query
+ case CMSG_CALENDAR_ADD_EVENT: // 21 10 2 async db query
case CMSG_CALENDAR_UPDATE_EVENT: // not profiled
case CMSG_CALENDAR_REMOVE_EVENT: // not profiled
case CMSG_CALENDAR_COPY_EVENT: // not profiled
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 23262c1657f..3ee0c596980 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -1146,6 +1146,10 @@ class TC_GAME_API WorldSession
void SendTimeSync();
uint32 AdjustClientMovementTime(uint32 time) const;
+ // Packets cooldown
+ time_t GetCalendarEventCreationCooldown() const { return _calendarEventCreationCooldown; }
+ void SetCalendarEventCreationCooldown(time_t cooldown) { _calendarEventCreationCooldown = cooldown; }
+
// Battle Pets
BattlePets::BattlePetMgr* GetBattlePetMgr() const { return _battlePetMgr.get(); }
@@ -1308,7 +1312,6 @@ class TC_GAME_API WorldSession
void HandleRequestRaidInfoOpcode(WorldPackets::Party::RequestRaidInfo& packet);
void HandlePartyInviteOpcode(WorldPackets::Party::PartyInviteClient& packet);
- //void HandleGroupCancelOpcode(WorldPacket& recvPacket);
void HandlePartyInviteResponseOpcode(WorldPackets::Party::PartyInviteResponse& packet);
void HandlePartyUninviteOpcode(WorldPackets::Party::PartyUninvite& packet);
void HandleSetPartyLeaderOpcode(WorldPackets::Party::SetPartyLeader& packet);
@@ -1933,6 +1936,9 @@ class TC_GAME_API WorldSession
uint32 _timeSyncNextCounter;
uint32 _timeSyncTimer;
+ // Packets cooldown
+ time_t _calendarEventCreationCooldown;
+
std::unique_ptr<BattlePets::BattlePetMgr> _battlePetMgr;
std::unique_ptr<CollectionMgr> _collectionMgr;