static std::string sasl_target;
-class ServerTracker : public ServerEventListener
+class ServerTracker
+ : public ServerProtocol::LinkEventListener
{
bool online;
public:
ServerTracker(Module* mod)
- : ServerEventListener(mod)
+ : ServerProtocol::LinkEventListener(mod)
{
Reset();
}
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();
}
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: