From 7d84e4900fa8f4ef96e8cf4bb67b76be7902e840 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 4 Apr 2021 23:42:15 +0100 Subject: Fix a ton of pedantic compiler warnings. --- src/modules/m_sasl.cpp | 72 ++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 38 deletions(-) (limited to 'src/modules/m_sasl.cpp') 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; - - if (msg.size() < 4) - return this->state; - - if (msg[2] == "C") - { - ClientProtocol::Message authmsg("AUTHENTICATE"); - authmsg.PushParamRef(msg[3]); - - 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()); + case SASL_INIT: + this->agent = msg[0]; + this->state = SASL_COMM; + [[fallthrough]]; + + case SASL_COMM: + if (msg[0] != this->agent) + return this->state; + + if (msg.size() < 4) + return this->state; + + if (msg[2] == "C") + { + ClientProtocol::Message authmsg("AUTHENTICATE"); + authmsg.PushParamRef(msg[3]); + + 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; - break; - case SASL_DONE: - break; - default: - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "WTF: SaslState is not a known state (%d)", this->state); - 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; -- cgit v1.3.1-10-gc9f91