From ee44af8d04f23b4a16c9b377764f930d69e575f7 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 27 Nov 2022 07:32:42 +0000 Subject: Refactor the internals of the oper system. - Allow overriding privileges from the blocks in the and blocks. - Separate oper types from oper accounts in the code. This enables moving some core stuff out of the config tag later. - Merge the config tags together to make a synthetic tag that can have getXXX called on it instead of using getConfig and then converting it. - Move the details of Have*Permission into the oper type class. - Improve oper events to allow modules to easily hook into the oper system. --- src/modules/m_ldapoper.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/modules/m_ldapoper.cpp') diff --git a/src/modules/m_ldapoper.cpp b/src/modules/m_ldapoper.cpp index 78a235919..57e570d31 100644 --- a/src/modules/m_ldapoper.cpp +++ b/src/modules/m_ldapoper.cpp @@ -85,16 +85,16 @@ public: void OnResult(const LDAPResult& r) override { auto user = ServerInstance->Users.FindUUID(uid); - ServerConfig::OperIndex::const_iterator iter = ServerInstance->Config->oper_blocks.find(opername); + auto iter = ServerInstance->Config->OperAccounts.find(opername); - if (!user || iter == ServerInstance->Config->oper_blocks.end()) + if (!user || iter == ServerInstance->Config->OperAccounts.end()) { Fallback(); delete this; return; } - user->Oper(iter->second); + user->OperLogin(iter->second); delete this; } }; @@ -219,15 +219,11 @@ public: const std::string& opername = parameters[0]; const std::string& password = parameters[1]; - ServerConfig::OperIndex::const_iterator it = ServerInstance->Config->oper_blocks.find(opername); - if (it == ServerInstance->Config->oper_blocks.end()) + auto it = ServerInstance->Config->OperAccounts.find(opername); + if (it == ServerInstance->Config->OperAccounts.end()) return MOD_RES_PASSTHRU; - std::shared_ptr tag = it->second->oper_block; - if (!tag) - return MOD_RES_PASSTHRU; - - std::string acceptedhosts = tag->getString("host"); + std::string acceptedhosts = it->second->GetConfig()->getString("host"); if (!InspIRCd::MatchMask(acceptedhosts, user->MakeHost(), user->MakeHostIP())) return MOD_RES_PASSTHRU; -- cgit v1.3.1-10-gc9f91