summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-12-05 16:01:30 +0100
committerAttila Molnar <attilamolnar@hush.com>2015-12-05 16:01:30 +0100
commitddc6999a1db1aa1e9bf9df2f1ab444c387bcd5b1 (patch)
tree0b184ca25346b4cf16d9d81e186fd5088af405d5 /src
parent302053cf8f5378da7f23e5d2f68a24c9d2325351 (diff)
m_sasl Advertise SASL mechanism list to supporting clients
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_sasl.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index 4d1dbbc71..7570e7732 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -26,6 +26,8 @@
class SASLCap : public Cap::Capability
{
+ std::string mechlist;
+
bool OnRequest(LocalUser* user, bool adding) CXX11_OVERRIDE
{
// Requesting this cap is allowed anytime
@@ -36,11 +38,25 @@ class SASLCap : public Cap::Capability
return (user->registered != REG_ALL);
}
+ const std::string* GetValue(LocalUser* user) const CXX11_OVERRIDE
+ {
+ return &mechlist;
+ }
+
public:
SASLCap(Module* mod)
: Cap::Capability(mod, "sasl")
{
}
+
+ void SetMechlist(const std::string& newmechlist)
+ {
+ if (mechlist == newmechlist)
+ return;
+
+ mechlist = newmechlist;
+ NotifyValueChange();
+ }
};
enum SaslState { SASL_INIT, SASL_COMM, SASL_DONE };
@@ -305,6 +321,12 @@ class ModuleSASL : public Module
return MOD_RES_PASSTHRU;
}
+ void OnDecodeMetaData(Extensible* target, const std::string& extname, const std::string& extdata) CXX11_OVERRIDE
+ {
+ if ((target == NULL) && (extname == "saslmechlist"))
+ cap.SetMechlist(extdata);
+ }
+
Version GetVersion() CXX11_OVERRIDE
{
return Version("Provides support for IRC Authentication Layer (aka: SASL) via AUTHENTICATE.", VF_VENDOR);