summaryrefslogtreecommitdiff
path: root/src/modules/m_sasl.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-04-25 13:24:40 +0200
committerAttila Molnar <attilamolnar@hush.com>2016-04-25 13:24:40 +0200
commit72501adb5c721ac7b8d148c53305457e2c5a5921 (patch)
tree13bdd9ddc821351ff125d0a472416199ca060f42 /src/modules/m_sasl.cpp
parent2595b35cc2191d33a625d041f31c41ab23156185 (diff)
m_sasl Advertise the sasl capability only if the target server is online
Issue #812
Diffstat (limited to 'src/modules/m_sasl.cpp')
-rw-r--r--src/modules/m_sasl.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index a6edb8b70..02a302c11 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -89,6 +89,7 @@ class ServerTracker : public SpanningTreeEventListener
class SASLCap : public Cap::Capability
{
std::string mechlist;
+ const ServerTracker& servertracker;
bool OnRequest(LocalUser* user, bool adding) CXX11_OVERRIDE
{
@@ -100,14 +101,20 @@ class SASLCap : public Cap::Capability
return (user->registered != REG_ALL);
}
+ bool OnList(LocalUser* user) CXX11_OVERRIDE
+ {
+ return servertracker.IsOnline();
+ }
+
const std::string* GetValue(LocalUser* user) const CXX11_OVERRIDE
{
return &mechlist;
}
public:
- SASLCap(Module* mod)
+ SASLCap(Module* mod, const ServerTracker& tracker)
: Cap::Capability(mod, "sasl")
+ , servertracker(tracker)
{
}
@@ -351,7 +358,7 @@ class ModuleSASL : public Module
ModuleSASL()
: authExt("sasl_auth", ExtensionItem::EXT_USER, this)
, servertracker(this)
- , cap(this)
+ , cap(this, servertracker)
, auth(this, authExt, cap)
, sasl(this, authExt)
, sasleventprov(this, "event/sasl")