summaryrefslogtreecommitdiff
path: root/src/modules/m_sasl.cpp
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2017-10-11 00:10:29 +0100
committerPeter Powell <petpow@saberuk.com>2017-10-11 01:34:58 +0100
commite0ee89ff9751363c7639c8c83506591de1b5859a (patch)
tree982f3c79d58acd0c0034a5f7cf9b2f1fb15fdc89 /src/modules/m_sasl.cpp
parent6acb2dcdd235e2594f800f33978e1a598c7792da (diff)
Convert the AUTHENTICATE handler to use SplitCommand.
Diffstat (limited to 'src/modules/m_sasl.cpp')
-rw-r--r--src/modules/m_sasl.cpp23
1 files changed, 10 insertions, 13 deletions
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<SaslAuthenticator>& authExt;
Cap::Capability& cap;
CommandAuthenticate(Module* Creator, SimpleExtItem<SaslAuthenticator>& 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<std::string>& parameters, User *user)
+ CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser* user)
{
{
if (!cap.get(user))