From e0ee89ff9751363c7639c8c83506591de1b5859a Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 11 Oct 2017 00:10:29 +0100 Subject: Convert the AUTHENTICATE handler to use SplitCommand. --- src/modules/m_sasl.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/modules/m_sasl.cpp') diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 9272efe0e..d2f04d9d2 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -157,7 +157,7 @@ class SaslAuthenticator { private: std::string agent; - User *user; + LocalUser* user; SaslState state; SaslResult result; bool state_announced; @@ -214,7 +214,7 @@ class SaslAuthenticator } public: - SaslAuthenticator(User* user_, const std::string& method) + SaslAuthenticator(LocalUser* user_, const std::string& method) : user(user_), state(SASL_INIT), state_announced(false) { SendHostIP(); @@ -225,14 +225,9 @@ class SaslAuthenticator params.push_back("S"); params.push_back(method); - LocalUser* localuser = IS_LOCAL(user); - if (localuser) - { - std::string fp = SSLClientCert::GetFingerprint(&localuser->eh); - - if (fp.size()) - params.push_back(fp); - } + const std::string fp = SSLClientCert::GetFingerprint(&user->eh); + if (fp.size()) + params.push_back(fp); SendSASL(params); } @@ -340,19 +335,21 @@ class SaslAuthenticator } }; -class CommandAuthenticate : public Command +class CommandAuthenticate : public SplitCommand { public: SimpleExtItem& authExt; Cap::Capability& cap; CommandAuthenticate(Module* Creator, SimpleExtItem& ext, Cap::Capability& Cap) - : Command(Creator, "AUTHENTICATE", 1), authExt(ext), cap(Cap) + : SplitCommand(Creator, "AUTHENTICATE", 1) + , authExt(ext) + , cap(Cap) { works_before_reg = true; allow_empty_last_param = false; } - CmdResult Handle (const std::vector& parameters, User *user) + CmdResult HandleLocal(const std::vector& parameters, LocalUser* user) { { if (!cap.get(user)) -- cgit v1.2.3