Fixes a crash that happened when rand32 returned negative values.
Also updated some related comments that were outdated since we changed to SFMT.
Closes#12638
* Fix some codestyle, fix some typos
* Change CMakeLists for: Custom (can be uncommented), Events, World
** Custom is theoretically unchanged. You can, however, uncomment the glob_recurse that initializes every file within. This might be easier for beginners.
* Introducing the IP Based Action Log System:
** On several different actions, e.g. Login, Character Login, etc., a new entry is added
** Can be logged on and off in worldserver config
*** Disabled by default to prevent increased log db size for unknowing users.
* Add a new row to account table called 'last_attempt_ip'
** Lists the last ip trying to connect to the account
* Add a new type of HookScripts: AccountScript
** Includes: OnAccountLogin, OnFailedAccountLogin, OnEmailChange, OnFailedChange, OnPasswordChange, OnFailedPasswordChange
* Added new Hook to PlayerScripts: OnFailedPlayerDelete
* Added new variables to PlayerScripts: OnPlayerDelete
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.
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)
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".
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
- 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