From 58478a241a964e48fa96e19db9cca8c32d1a60ae Mon Sep 17 00:00:00 2001 From: Sebastian Joseph Date: Mon, 11 Apr 2016 23:18:12 +0200 Subject: [PATCH] Implemented an option to restict access to only known players. --- src/defaultsettings.cpp | 1 + src/server.cpp | 8 ++++++++ voxelands.conf.example | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index af662c9..d0039d4 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -124,6 +124,7 @@ void set_default_settings(Settings *settings) settings->setDefault("max_users", "20"); settings->setDefault("strict_protocol_version_checking", "false"); settings->setDefault("disallow_empty_passwords","false"); + settings->setDefault("disallow_unknown_users","false"); settings->setDefault("fixed_map_seed", ""); settings->setDefault("default_password", ""); settings->setDefault("default_privs", "build, shout"); diff --git a/src/server.cpp b/src/server.cpp index bb370b3..69aeb36 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1856,6 +1856,14 @@ void Server::ProcessData(u8 *data, u32 datasize, u16 peer_id) SendAccessDenied(m_con, peer_id, L"Empty passwords are not allowed on this server."); return; } + + if (g_settings->getBool("disallow_unknown_users") && + !m_authmanager.exists(playername)) { + infostream<<"Server: unknown player "<