summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-01-16 10:26:16 -0800
committerAttila Molnar <attilamolnar@hush.com>2014-01-16 10:26:16 -0800
commit69a2d4e9b2c5f90dc8ed3e5efca357c25eedbf74 (patch)
tree95c4ab3ad3adb75c841ef6083f4aea3c524f06cb
parent1df66532700845a64e9ad2909c55c00bbf1d4e8d (diff)
parent1c89cb1002c915a18abd1dda2204b5c3ea1b5515 (diff)
Merge pull request #732 from grawity/saslfix
m_sasl: properly handle bad-mechanism failures
-rw-r--r--src/modules/m_sasl.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index b67111987..66efcfe4e 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -93,20 +93,23 @@ class SaslAuthenticator
{
case SASL_INIT:
this->agent = msg[0];
- this->user->Write("AUTHENTICATE %s", msg[3].c_str());
this->state = SASL_COMM;
- break;
+ /* fall through */
case SASL_COMM:
if (msg[0] != this->agent)
return this->state;
- if (msg[2] != "D")
+ if (msg[2] == "C")
this->user->Write("AUTHENTICATE %s", msg[3].c_str());
- else
+ else if (msg[2] == "D")
{
this->state = SASL_DONE;
this->result = this->GetSaslResult(msg[3]);
}
+ else if (msg[2] == "M")
+ this->user->WriteNumeric(908, "%s %s :are available SASL mechanisms", this->user->nick.c_str(), msg[3].c_str());
+ else
+ ServerInstance->Logs->Log("m_sasl", DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str());
break;
case SASL_DONE: