Commit Graph

686 Commits

Author SHA1 Message Date
Shauren
0f5632c70e Core/Misc: Fixed some -Weffc++ warnings 2014-04-20 16:48:35 +02:00
joschiwald
b000fdca70 Core/Entities: allow interaction with gameobject questgivers if player can take or return quests
Closes #11269
Closes #8898
Closes #10204
Closes #11410
Closes #7053
Closes #6189
Closes #9474
2014-02-06 21:23:18 +01:00
Dehravor
00f5460530 Core/Misc: Fix crash 2014-01-19 16:44:03 +01:00
Discover-
f6264169d8 Merge pull request #11299 from Carbenium/MailboxCmd
Core/Command: Add mailbox command
2014-01-19 07:29:11 -08:00
joschiwald
41b613186e Core/Battlefield: some codestyle changes 2014-01-10 17:42:08 +01:00
Shauren
ad84759d2f Core/Threading: Handle CMSG_ZONEUPDATE only in WorldSession update - changing zones triggers changing chat channels, what is not a thread safe operation 2014-01-05 00:52:10 +01:00
Vincent_Michael
20004050bc Update copyright note for 2014.
Happy new year.
2014-01-01 00:07:53 +01:00
Shauren
293915db39 Core/Quests: Fixed icon shown above questgivers with daily quests that have already been completed once by a character
Closes #11331
2013-12-25 02:08:05 +01:00
jackpoz
1c0903e286 Core/Misc: Fix some static analysis issues
Fix some static analysis issues about uninitialized values. Most of them are false positives, always initialized before being accessed, while some of them are real issues spotted by valgrind too.
2013-12-14 18:41:26 +01:00
d-sat
2f3cc24e7f Renamed method 2013-12-12 23:38:32 +01:00
Carbenium
fa2616fe4e Add mailbox command 2013-12-06 21:37:55 +01:00
Spp
94e2b9332a Core/Logging: Remove LOG_FILTER_XXX defines with it's value (remember logger names are case-sensitive) 2013-11-08 10:50:51 +01:00
jackpoz
7e904b1dc0 Core/Threads: Include Helgrind suppressions file
Include a Helgrind suppressions file under source control. Each suppressed race is either a false positive, a read race followed by a lock acquire anyway, a bool race. Suppressions related to the same issue in the same function are grouped with a counter in brackets [ ] .

Fix tabs added in bcee801e4b .
2013-11-04 20:24:28 +01:00
jackpoz
bcee801e4b Core/Network: Fix race condition in WorldSession timeout
Helgrind log:
 Lock at 0x2BD582E0 was first observed
  at : pthread_mutex_init (hg_intercepts.c:443)
  by : ACE_OS::mutex_init(pthread_mutex_t*, int, char const*, pthread_mutexattr_t*, int, int) (in /usr/lib/libACE-6.0.3.so)
  by : ACE_Thread_Mutex::ACE_Thread_Mutex(char const*, pthread_mutexattr_t*) (in /usr/lib/libACE-6.0.3.so)
  by : WorldSocket::WorldSocket() (WorldSocket.cpp:106)
  by : ACE_Acceptor<WorldSocket, ACE_SOCK_Acceptor>::make_svc_handler(WorldSocket*&) (Acceptor.cpp:261)
  by : ACE_Acceptor<WorldSocket, ACE_SOCK_Acceptor>::handle_input(int) (Acceptor.cpp:396)
  by : ACE_Dev_Poll_Reactor::dispatch_io_event(ACE_Dev_Poll_Reactor::Token_Guard&) (in /usr/lib/libACE-6.0.3.so)
  by : ACE_Dev_Poll_Reactor::handle_events(ACE_Time_Value*) (in /usr/lib/libACE-6.0.3.so)
  by : ACE_Reactor::run_reactor_event_loop(ACE_Time_Value&, int (*)(ACE_Reactor*)) (in /usr/lib/libACE-6.0.3.so)
  by : ReactorRunnable::svc() (WorldSocketMgr.cpp:170)
  by : ACE_Task_Base::svc_run(void*) (in /usr/lib/libACE-6.0.3.so)
  by : ACE_Thread_Adapter::invoke_i() (in /usr/lib/libACE-6.0.3.so)

 Possible data race during write of size 8 at 0x2BD6F6F8 by thread #12
 Locks held: 1, at address 0x2BD582E0
  at : WorldSession::ResetTimeOutTime() (WorldSession.h:372)
  by : WorldSocket::ProcessIncoming(WorldPacket*) (WorldSocket.cpp:709)
  by : WorldSocket::handle_input_payload() (WorldSocket.cpp:517)
  by : WorldSocket::handle_input_missing_data() (WorldSocket.cpp:610)
  by : WorldSocket::handle_input(int) (WorldSocket.cpp:282)
  by : ACE_Dev_Poll_Reactor::dispatch_io_event(ACE_Dev_Poll_Reactor::Token_Guard&) (in /usr/lib/libACE-6.0.3.so)
  by : ACE_Dev_Poll_Reactor::handle_events(ACE_Time_Value*) (in /usr/lib/libACE-6.0.3.so)
  by : ACE_Reactor::run_reactor_event_loop(ACE_Time_Value&, int (*)(ACE_Reactor*)) (in /usr/lib/libACE-6.0.3.so)
  by : ReactorRunnable::svc() (WorldSocketMgr.cpp:170)
  by : ACE_Task_Base::svc_run(void*) (in /usr/lib/libACE-6.0.3.so)
  by : ACE_Thread_Adapter::invoke_i() (in /usr/lib/libACE-6.0.3.so)
  by : ACE_Thread_Adapter::invoke() (in /usr/lib/libACE-6.0.3.so)

 This conflicts with a previous write of size 8 by thread #7
 Locks held: none
  at : WorldSession::UpdateTimeOutTime(unsigned int) (WorldSession.h:368)
  by : WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:256)
  by : World::UpdateSessions(unsigned int) (World.cpp:2646)
  by : World::Update(unsigned int) (World.cpp:2003)
  by : WorldRunnable::run() (WorldRunnable.cpp:60)
  by : ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)
  by : ACE_OS_Thread_Adapter::invoke() (in /usr/lib/libACE-6.0.3.so)
  by : mythread_wrapper (hg_intercepts.c:233)
2013-11-03 18:07:17 +01:00
leguybrush
0a308144a8 Core/Code: Unify [more] codestyle for brackets: )\n{\n} to ) { }. 2013-10-28 14:36:07 -04:00
Ascathor
2607738990 Core/Code: Unify codestyle for brackets: {} to { }.
Also added missing copyright to some files.
2013-10-27 23:46:02 +01:00
jackpoz
4aee86627e Core/WorldSession: Mitigate DoS attacks
Mitigate DoS attacks like one explained in #10555 by processing a limited number of packets at each WorldSession::Update() call, allowing other WorldSessions to be processed.
100 packets in a single update sound like a reasonable amount.
2013-10-17 22:03:51 +02:00
Shauren
ce55647c41 Core/Transports
* Rewritten path generation, now uses splines - timers are a lot more accurate now
* Implemented stopping transports
* Implemented spawning transports in instances
* Implemented spawning gameobjects as transport passengers
* Transport passengers are now stored in creature/gameobject table using gameobject_template.data6 from transport's template as map id
2013-10-16 18:37:29 +02:00
Spp
895a23df11 Core/RBAC: Add default groups to accounts based on their security level.
- Removed config option RBAC.DefaultGroups

Use the table rbac_security_level_groups to configure the groups to be added to the account at load time.

Note: Those groups are only used at run time, never saved to DB
2013-09-27 13:35:45 +02:00
Spp
cfaea769bc Core/RBAC: Move RBAC code to namespace rbac 2013-09-27 13:35:45 +02:00
jackpoz
2cca3982d4 Core/Movement: Port Ascent r1637 http://sourceforge.net/p/ascentemubackup/code/1637/ to TrinityCore
Port some movement packet fixes, taking into account client/server connection lag.
Credits to original author, check http://sourceforge.net/p/ascentemubackup/code/1637/ for more details.
MOVEMENT_PACKET_TIME_DELAY default value is currently set to 0, feel free to set it to different values and report feedback.
2013-09-26 20:09:50 +02:00
jackpoz
f23b5fb96d Core/Socket: Fix race condition in WorldSocket
ReactorRunnable::svc() checks the status of WorldSockets while WorldRunnable::run() updates them, causing a race condition.

Helgrind log:
Possible data race during write of size 8 at 0x49961810 by thread #9
Locks held: 1, at address 0x4367A620
   at 0x51781F7: ACE_Message_Block::copy(char const*, unsigned long) (Message_Block.inl:372)
   by 0x15D048F: WorldSocket::SendPacket(WorldPacket const&) (WorldSocket.cpp:180)
   by 0x141C45E: WorldSession::SendPacket(WorldPacket const*) (WorldSession.cpp:223)
   by 0x15C49C4: WorldSession::SendAuthResponse(unsigned char, bool, unsigned int) (AuthHandler.cpp:37)
   by 0x14DA71C: World::AddSession_(WorldSession*) (World.cpp:278)
   by 0x14E601E: World::UpdateSessions(unsigned int) (World.cpp:2617)
   by 0x14E3E67: World::Update(unsigned int) (World.cpp:1986)
   by 0x100EAFA: WorldRunnable::run() (WorldRunnable.cpp:60)
   by 0x163A626: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)
   by 0x518F555: ACE_OS_Thread_Adapter::invoke() (OS_Thread_Adapter.cpp:103)
   by 0x4C2B5AD: mythread_wrapper (hg_intercepts.c:219)
   by 0x61DAB4F: start_thread (pthread_create.c:304)

This conflicts with a previous read of size 8 by thread #14
Locks held: none
   at 0x1008414: ACE_Message_Block::length() const (Message_Block.inl:131)
   by 0x15D1207: WorldSocket::Update() (WorldSocket.cpp:448)
   by 0x1427CA3: ReactorRunnable::svc() (WorldSocketMgr.cpp:177)
   by 0x51CBB16: ACE_Task_Base::svc_run(void*) (Task.cpp:271)
   by 0x51CD3BC: ACE_Thread_Adapter::invoke_i() (Thread_Adapter.cpp:161)
   by 0x51CD4D4: ACE_Thread_Adapter::invoke() (Thread_Adapter.cpp:96)
   by 0x4C2B5AD: mythread_wrapper (hg_intercepts.c:219)
   by 0x61DAB4F: start_thread (pthread_create.c:304)

Address 0x49961810 is 16 bytes inside a block of size 80 alloc'd
   at 0x4C286BB: operator new(unsigned long, std::nothrow_t const&) (vg_replace_malloc.c:316)
   by 0x15D0818: WorldSocket::open(void*) (WorldSocket.cpp:237)
   by 0x1429560: ACE_Acceptor<WorldSocket, ACE_SOCK_Acceptor>::activate_svc_handler(WorldSocket*) (Acceptor.cpp:347)
   by 0x142916D: ACE_Acceptor<WorldSocket, ACE_SOCK_Acceptor>::handle_input(int) (Acceptor.cpp:429)
   by 0x515F48D: ACE_Dev_Poll_Reactor::dispatch_io_event(ACE_Dev_Poll_Reactor::Token_Guard&) (Dev_Poll_Reactor.inl:86)
   by 0x5161653: ACE_Dev_Poll_Reactor::handle_events(ACE_Time_Value*) (Dev_Poll_Reactor.cpp:1015)
   by 0x51ACCFC: ACE_Reactor::run_reactor_event_loop(ACE_Time_Value&, int (*)(ACE_Reactor*)) (Reactor.cpp:267)
   by 0x1427C57: ReactorRunnable::svc() (WorldSocketMgr.cpp:170)
   by 0x51CBB16: ACE_Task_Base::svc_run(void*) (Task.cpp:271)
   by 0x51CD3BC: ACE_Thread_Adapter::invoke_i() (Thread_Adapter.cpp:161)
   by 0x51CD4D4: ACE_Thread_Adapter::invoke() (Thread_Adapter.cpp:96)
   by 0x4C2B5AD: mythread_wrapper (hg_intercepts.c:219)
2013-09-01 21:32:34 +02:00
Shauren
6b60877e3e Core/NetworkIO: Fixed memory leak 2013-09-01 17:48:47 +02:00
Vincent-Michael
87e105c818 Core: Fix warning 2013-08-30 20:56:41 +02:00
Nay
aa5bc37e9c Core: Yet more warning fixes 2013-08-30 16:03:37 +01:00
Nay
1903d4ca7d Core/Server: Fix a spammy warning in WorldSession and move code to .cpp 2013-08-30 15:44:17 +01:00
Machiavelli
9346695129 Core: Few fixes for previous commit. 2013-08-29 21:55:29 +01:00
Machiavelli
59b4c34924 Core/NetworkIO: Generic packet spam solution
Currently regulates the usage of CMSG_CHAR_ENUM only, but can be easily
extended to detect inappropriate network behaviour by using
AntiDOS.AllowOpcode in WorldSession's handlers.
2013-08-29 16:46:28 +01:00
QAston
2a3370929d Fix BigNumber::AsByteArray function by returning Auto_Ptr.
Remove mutex from BigNumber class - it didn't do what it was advertised to do - consider using the "locked" array outside of the function in which it was "locked".
2013-08-18 17:44:03 +02:00
Shauren
779a59e7e2 Core/Config: Refactored ConfigMgr
* Loading initial configuration files is now separate from loading any additional custom configs
2013-07-15 17:31:44 +02:00
Shauren
55fa58af19 Core/Movement: Prevent dynamic changes of movement flags for charmed creatures
Closes #10075
Closes #10079
2013-06-22 13:42:13 +02:00
Shauren
89ec907539 Core/Objects: Refactored MovementInfo structure 2013-06-18 18:15:33 +02:00
Malcrom
ec474a62e5 Core: More Function Renaming. 2013-06-11 21:25:12 -02:30
Shauren
9c0d69e33d Core/Items
* Updated structure of SMSG_ENCHANTMENTLOG and send it when changing enchantments on item
* Implemented SMSG_SOCKET_GEMS_RESULT sent when socketing is finished
2013-05-25 11:09:21 +02:00
Spp
d1677b2db0 Core/Logging: Performance-related tweaks to logging system
All sLog->out* functions (except outCommand atm) are replaced with TC_LOG_* macros.
    Memleak fix
2013-05-13 15:07:36 +02:00
Shauren
d24ef896df Core/PacketIO: Implemented possibility to ban client addons serverside 2013-04-05 15:06:35 +02:00
Nefarion
46ba2d945a Allow reply to whispers if you are under CONFIG_CHAT_WHISPER_LEVEL_REQ, and implement feature for GMs to remove single players from their WhisperWhiteList. 2013-03-15 10:27:18 +01:00
Nefarion
49fd11ab5a First step of comment style refactoring to doxygen-style. 2013-03-08 21:55:37 +01:00
Spp
480c6cf4dd Core/RBAC: Add .reload rbac command and prevent possible crash if rbac_permissions has wrong data 2013-02-27 03:30:53 +01:00
Spp
00c58f25d7 Core/RBAC: Force loadPermissions before checking session permissions if the storage is null (someone created a session but forgot to call to LoadPermissions) 2013-02-26 22:35:55 +01:00
Spp
e99dd15915 Core/RBAC: Create new permission 'Skip over-speed ping check' 2013-02-25 15:48:18 +01:00
Spp
15343d9bb0 Core/RBAC: Remove unnecessary header includes from other header files 2013-02-25 15:48:17 +01:00
Shauren
59c3c6b8a6 Core/Players: Allow players to log out in combat when they are in resting area (logout in rest area is instant by default, but not when in combat) 2013-02-20 20:52:58 +01:00
Machiavelli
1093abb1ad Core/Handlers: Prevent some cheating in CharacterHandler
Prevents factionchanging and char customising of characters that do not
belong to the current account.
2013-02-14 16:07:36 +01:00
Nay
42e660e2a2 Core/Sockets: Always try to send MSG_NOSIGNAL in peer().send()
Fixes RASocket::authenticate crash

"MSG_NOSIGNAL:
If you send() to a remote host which is no longer recv()ing, you'll typically get the signal SIGPIPE. Adding this flag prevents that signal from being raised."

Closes #5040
Thanks to @derex for the hint
2013-02-11 02:59:37 +00:00
Shauren
b6e56e42ea Core/Auth: Reverted part of fb43a92cc2 - session key is still needed after logging in to be able to switch realms 2013-02-08 01:03:56 +01:00
Shauren
fb43a92cc2 Core/Accounts: sessionkey field in account table is only a temporary storage to pass data from authserver to worldserver and should only be used as such. Clearing sessionkey from database after a successful login to prevent possible exploits. 2013-02-07 16:15:23 +01:00
Aokromes
6d8a69d640 Merge pull request #9099 from Bezo/mutenew
Add Mute reason and mute by to the db so you can get this info from the ...
2013-02-04 06:55:26 -08:00
Spp
b980aff83e Core: Implement Role based Access Control
- This system will give more control of actions an account can perform.

System defines:
- Permissions to perform some action
- Roles: a set of permissions that have some relation
- Groups: a set of roles that have some relation

Operations:
- Grant: Assign and allow
- Deny: Assign and do not allow
- Revoke: Remove

Precedence to know if something can be done: Grant, Deny. That means, if you are granted some action by a role but you have denied the permission, the action can not be done.

Some Rules:
- Groups can only have roles
- Roles can only have permissions
- An account can be assigned granted and denied roles. Permissions inherited from roles are granted if roles is granted and denied if roles is denied
- An account can be assigned granted and denied permissions
- An account can have multiple groups, roles and permissions
- An account can not have same role granted and denied at same time
- An acconnt can not have same permission granted and denied at same time
- Id 0 can not be used to define a group, role or permission

Added some permissions as a sample of use (Instant Logout, Skip Queue, Join BGs, Join DF) and some permissions as a workaround to commands till command system is modified to use RBAC
2013-02-04 09:04:33 +01:00
Spp
9bdfc87774 Core/Dungeon Finder: Use lfg namespace to encapsulate all LFG classes, structs and enums 2013-02-04 04:43:50 +01:00