diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-09-04 22:08:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-04 22:08:59 +0200 |
commit | 40dd03e328ff0ae36338615114cb38879752756e (patch) | |
tree | 0ffe5ded06cce82f2b528284c1b5f5aba73f203e /src/network | |
parent | c05228fa6d446022cdf675865f9a420c95619313 (diff) | |
download | minetest-40dd03e328ff0ae36338615114cb38879752756e.tar.gz minetest-40dd03e328ff0ae36338615114cb38879752756e.tar.bz2 minetest-40dd03e328ff0ae36338615114cb38879752756e.zip |
Implement minetest.register_can_bypass_userlimit (#6369)
* Implement minetest.register_on_userlimit_check
This new callback permits to bypass the max_users parameter with new mods condition, based on player name or IP
Only one mod needs to permit it.
Move core part for builtin privileges checks to builtin
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/serverpackethandler.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 62da136ad..ecf4306c8 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -209,13 +209,10 @@ void Server::handleCommand_Init(NetworkPacket* pkt) << addr_s << " (peer_id=" << pkt->getPeerId() << ")" << std::endl; // Enforce user limit. - // Don't enforce for users that have some admin right + // Don't enforce for users that have some admin right or mod permits it. if (m_clients.isUserLimitReached() && - !checkPriv(playername, "server") && - !checkPriv(playername, "ban") && - !checkPriv(playername, "privs") && - !checkPriv(playername, "password") && - playername != g_settings->get("name")) { + playername != g_settings->get("name") && + !m_script->can_bypass_userlimit(playername, addr_s)) { actionstream << "Server: " << playername << " tried to join from " << addr_s << ", but there" << " are already max_users=" << g_settings->getU16("max_users") << " players." << std::endl; |