X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_sasl.cpp;h=9813ba6b52762351c948c0c702c2a1c3ec667ced;hb=cf5d382b822cecd54fdbc77e4c1c4de8a8aa3c35;hp=54bb8a44a7a1243cc7a2dfcafca1c4d89ddb4126;hpb=87b1461e2a4710a38b32186c2582da9fe9bb3804;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 54bb8a44a..9813ba6b5 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -37,7 +37,8 @@ enum static std::string sasl_target; -class ServerTracker : public ServerEventListener +class ServerTracker + : public ServerProtocol::LinkEventListener { bool online; @@ -58,14 +59,14 @@ class ServerTracker : public ServerEventListener Update(server, true); } - void OnServerSplit(const Server* server) CXX11_OVERRIDE + void OnServerSplit(const Server* server, bool error) CXX11_OVERRIDE { Update(server, false); } public: ServerTracker(Module* mod) - : ServerEventListener(mod) + : ServerProtocol::LinkEventListener(mod) { Reset(); } @@ -103,16 +104,15 @@ class SASLCap : public Cap::Capability bool OnRequest(LocalUser* user, bool adding) CXX11_OVERRIDE { - // Requesting this cap is allowed anytime - if (adding) - return true; - - // But removing it can only be done when unregistered - return (user->registered != REG_ALL); + // Servers MUST NAK any sasl capability request if the authentication layer + // is unavailable. + return servertracker.IsOnline(); } bool OnList(LocalUser* user) CXX11_OVERRIDE { + // Servers MUST NOT advertise the sasl capability if the authentication layer + // is unavailable. return servertracker.IsOnline(); } @@ -284,7 +284,7 @@ class SaslAuthenticator case SASL_OK: this->user->WriteNumeric(RPL_SASLSUCCESS, "SASL authentication successful"); break; - case SASL_ABORT: + case SASL_ABORT: this->user->WriteNumeric(ERR_SASLABORTED, "SASL authentication aborted"); break; case SASL_FAIL: