From 02aeb254ee33abadefba8b9b33e576f5ea0ce353 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 1 Aug 2025 13:57:47 +0100 Subject: [PATCH] Add an option to disable the encryption and database module checks. --- include/anope.h | 2 +- src/init.cpp | 14 ++++++++++---- src/main.cpp | 2 +- src/module.cpp | 3 +++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/include/anope.h b/include/anope.h index 3cc6b602d..505f6d9c3 100644 --- a/include/anope.h +++ b/include/anope.h @@ -383,7 +383,7 @@ namespace Anope /** Other command line options. */ - extern CoreExport bool ReadOnly, NoFork, NoThird, NoPID, NoExpire, ProtocolDebug; + extern CoreExport bool ReadOnly, NoFork, NoThird, NoDB, NoPID, NoExpire, ProtocolDebug; /** The root of the Anope installation. Usually ~/anope */ diff --git a/src/init.cpp b/src/init.cpp index 1ade6be64..4f154025b 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -382,6 +382,9 @@ bool Anope::Init(int ac, char **av) if (GetCommandLineArgument("noexpire", 'e')) Anope::NoExpire = true; + if (GetCommandLineArgument("nodb", 'b')) + Anope::NoDB = true; + if (GetCommandLineArgument("protocoldebug")) Anope::ProtocolDebug = true; @@ -552,11 +555,14 @@ bool Anope::Init(int ac, char **av) setuidgid(); #endif - if (!ModuleManager::FindFirstOf(DATABASE)) - throw CoreException("You must load a non-deprecated database module!"); + if (!Anope::NoDB) + { + if (!ModuleManager::FindFirstOf(DATABASE)) + throw CoreException("You must load a non-deprecated database module!"); - if (!ModuleManager::FindFirstOf(ENCRYPTION)) - throw CoreException("You must load a non-deprecated encryption module!"); + if (!ModuleManager::FindFirstOf(ENCRYPTION)) + throw CoreException("You must load a non-deprecated encryption module!"); + } if (!IRCD) throw CoreException("You must load a protocol module!"); diff --git a/src/main.cpp b/src/main.cpp index fcb3efe89..fb33b5f03 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,7 +24,7 @@ /* Command-line options: */ unsigned Anope::Debug = 0; -bool Anope::ReadOnly = false, Anope::NoFork = false, Anope::NoThird = false, Anope::NoPID = false, Anope::NoExpire = false, Anope::ProtocolDebug = false; +bool Anope::ReadOnly = false, Anope::NoFork = false, Anope::NoThird = false, Anope::NoDB = false, Anope::NoPID = false, Anope::NoExpire = false, Anope::ProtocolDebug = false; Anope::string Anope::ServicesDir; Anope::string Anope::ServicesBin; diff --git a/src/module.cpp b/src/module.cpp index 6b6a4e36c..4e0a86d43 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -34,6 +34,9 @@ Module::Module(const Anope::string &modname, const Anope::string &, ModType modt if (ModuleManager::FindModule(this->name)) throw CoreException("Module already exists!"); + if (Anope::NoDB && type & DATABASE) + throw ModuleException("Database modules may not be loaded"); + if (Anope::NoThird && type & THIRD) throw ModuleException("Third party modules may not be loaded");