]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sasl.cpp
Add whether the server split with an error to OnServerSplit.
[user/henk/code/inspircd.git] / src / modules / m_sasl.cpp
index 2647b63e12efbb664ef12b41e0492a14860e73a2..9813ba6b52762351c948c0c702c2a1c3ec667ced 100644 (file)
@@ -59,7 +59,7 @@ class ServerTracker
                Update(server, true);
        }
 
-       void OnServerSplit(const Server* server) CXX11_OVERRIDE
+       void OnServerSplit(const Server* server, bool error) CXX11_OVERRIDE
        {
                Update(server, false);
        }
@@ -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();
        }
 
@@ -285,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: