X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_sasl.cpp;h=6aaa83f3371abf10cbc6392aec7bb9cf59f9677c;hb=3151d60c1ecc9462e4c335282ee6c31672f45111;hp=ebacd8587d0859d276c158d36618c4930d19c231;hpb=8ebe4ce2cb0331abfffd9f72455b17adfeea7bf2;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index ebacd8587..6aaa83f33 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -1,8 +1,15 @@ /* * InspIRCd -- Internet Relay Chat Daemon * + * Copyright (C) 2016 Adam + * Copyright (C) 2014 Mantas Mikulėnas + * Copyright (C) 2013-2016, 2018 Attila Molnar + * Copyright (C) 2013, 2017-2020 Sadie Powell + * Copyright (C) 2013 Daniel Vassdal + * Copyright (C) 2012, 2019 Robby * Copyright (C) 2009-2010 Daniel De Graaf - * Copyright (C) 2008 Craig Edwards + * Copyright (C) 2008, 2010 Craig Edwards + * Copyright (C) 2008 Thomas Stagner * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -102,11 +109,16 @@ class ServerTracker class SASLCap : public Cap::Capability { + private: std::string mechlist; const ServerTracker& servertracker; + UserCertificateAPI sslapi; bool OnRequest(LocalUser* user, bool adding) CXX11_OVERRIDE { + if (requiressl && sslapi && !sslapi->GetCertificate(user)) + return false; + // Servers MUST NAK any sasl capability request if the authentication layer // is unavailable. return servertracker.IsOnline(); @@ -114,6 +126,9 @@ class SASLCap : public Cap::Capability bool OnList(LocalUser* user) CXX11_OVERRIDE { + if (requiressl && sslapi && !sslapi->GetCertificate(user)) + return false; + // Servers MUST NOT advertise the sasl capability if the authentication layer // is unavailable. return servertracker.IsOnline(); @@ -125,9 +140,11 @@ class SASLCap : public Cap::Capability } public: + bool requiressl; SASLCap(Module* mod, const ServerTracker& tracker) : Cap::Capability(mod, "sasl") , servertracker(tracker) + , sslapi(mod) { } @@ -419,10 +436,13 @@ class ModuleSASL : public Module void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - std::string target = ServerInstance->Config->ConfValue("sasl")->getString("target"); + ConfigTag* tag = ServerInstance->Config->ConfValue("sasl"); + + const std::string target = tag->getString("target"); if (target.empty()) throw ModuleException(" must be set to the name of your services server!"); + cap.requiressl = tag->getBool("requiressl"); sasl_target = target; servertracker.Reset(); } @@ -435,7 +455,7 @@ class ModuleSASL : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides support for IRC Authentication Layer (aka: SASL) via AUTHENTICATE", VF_VENDOR); + return Version("Provides the IRCv3 sasl client capability.", VF_VENDOR); } };