aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_sasl.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-04-04 23:42:15 +0100
committerGravatar Sadie Powell2021-04-04 23:42:15 +0100
commit7d84e4900fa8f4ef96e8cf4bb67b76be7902e840 (patch)
treef5a81d03f572392e7547d58f979fdd488de6ff0b /src/modules/m_sasl.cpp
parentRemove the unused ExitCodes array. (diff)
Fix a ton of pedantic compiler warnings.
Diffstat (limited to 'src/modules/m_sasl.cpp')
-rw-r--r--src/modules/m_sasl.cpp66
1 files changed, 31 insertions, 35 deletions
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index 095a42fe7..b7318c86d 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -231,43 +231,41 @@ class SaslAuthenticator
{
switch (this->state)
{
- case SASL_INIT:
- this->agent = msg[0];
- this->state = SASL_COMM;
- /* fall through */
- case SASL_COMM:
- if (msg[0] != this->agent)
- return this->state;
+ case SASL_INIT:
+ this->agent = msg[0];
+ this->state = SASL_COMM;
+ [[fallthrough]];
- if (msg.size() < 4)
- return this->state;
+ case SASL_COMM:
+ if (msg[0] != this->agent)
+ return this->state;
- if (msg[2] == "C")
- {
- ClientProtocol::Message authmsg("AUTHENTICATE");
- authmsg.PushParamRef(msg[3]);
+ if (msg.size() < 4)
+ return this->state;
- ClientProtocol::Event authevent(*g_protoev, authmsg);
- LocalUser* const localuser = IS_LOCAL(user);
- if (localuser)
- localuser->Send(authevent);
- }
- else if (msg[2] == "D")
- {
- this->state = SASL_DONE;
- this->result = this->GetSaslResult(msg[3]);
- }
- else if (msg[2] == "M")
- this->user->WriteNumeric(RPL_SASLMECHS, msg[3], "are available SASL mechanisms");
- else
- ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str());
+ if (msg[2] == "C")
+ {
+ ClientProtocol::Message authmsg("AUTHENTICATE");
+ authmsg.PushParamRef(msg[3]);
- break;
- case SASL_DONE:
- break;
- default:
- ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WTF: SaslState is not a known state (%d)", this->state);
- break;
+ ClientProtocol::Event authevent(*g_protoev, authmsg);
+ LocalUser* const localuser = IS_LOCAL(user);
+ if (localuser)
+ localuser->Send(authevent);
+ }
+ else if (msg[2] == "D")
+ {
+ this->state = SASL_DONE;
+ this->result = this->GetSaslResult(msg[3]);
+ }
+ else if (msg[2] == "M")
+ this->user->WriteNumeric(RPL_SASLMECHS, msg[3], "are available SASL mechanisms");
+ else
+ ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str());
+ break;
+
+ case SASL_DONE:
+ break;
}
return this->state;
@@ -306,8 +304,6 @@ class SaslAuthenticator
case SASL_FAIL:
this->user->WriteNumeric(ERR_SASLFAIL, "SASL authentication failed");
break;
- default:
- break;
}
this->state_announced = true;