From c6b5da1f6fdb1bc54ebe97ebe3666ad9ae85e99b Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 31 Jul 2019 22:16:28 +0100 Subject: Fix sasl hangs with clients that blindly request the capability. --- src/modules/m_sasl.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 0fb277b23..28bce2bf3 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -104,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(); } -- cgit v1.2.3