diff options
| author | 2022-01-30 20:48:47 +0000 | |
|---|---|---|
| committer | 2022-01-30 20:48:47 +0000 | |
| commit | c3d35d736efb667ce4e794104db6c3555fba9daa (patch) | |
| tree | 64489f94351459822f84d782314ca7d106b50b90 /src/modules | |
| parent | Kill vendor_directory in favour of normal include paths. (diff) | |
| parent | Abort pre-registration SASL attempts when the user fully connects. (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/m_sasl.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index b1fa82ecd..273a290bb 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -267,6 +267,12 @@ public: return this->state; } + void Abort() + { + this->state = SASL_DONE; + this->result = SASL_ABORT; + } + bool SendClientMessage(const std::vector<std::string>& parameters) { if (this->state != SASL_COMM) @@ -276,15 +282,14 @@ public: if (parameters[0].c_str()[0] == '*') { - this->state = SASL_DONE; - this->result = SASL_ABORT; + this->Abort(); return false; } return true; } - void AnnounceState(void) + void AnnounceState() { if (this->state_announced) return; @@ -437,6 +442,21 @@ public: servertracker.Reset(); } + void OnUserConnect(LocalUser* user) override + { + // If the client completes registration (with CAP END, NICK, USER and + // any other necessary messages) while the SASL authentication is still + // in progress, the server SHOULD abort it and send a 906 numeric, then + // register the client without authentication. + SaslAuthenticator* saslauth = authExt.Get(user); + if (saslauth) + { + saslauth->Abort(); + saslauth->AnnounceState(); + authExt.Unset(user); + } + } + void OnDecodeMetaData(Extensible* target, const std::string& extname, const std::string& extdata) override { if ((!target) && (extname == "saslmechlist")) |
