diff options
author | Adam <Adam@anope.org> | 2014-02-22 17:46:00 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-02-22 17:46:00 -0500 |
commit | e836be489e7997d5eac56d20ac779c3df2c5b91c (patch) | |
tree | 667d2fa25c14e955346d2f31fc644d98905356c2 /modules/m_sasl.cpp | |
parent | 1db5c555d6ecf26ab15931c1a3db208fbb94a171 (diff) |
Store a cert->account map and use it for SASL EXTERNAL and certfp auth
Diffstat (limited to 'modules/m_sasl.cpp')
-rw-r--r-- | modules/m_sasl.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/modules/m_sasl.cpp b/modules/m_sasl.cpp index c99f052ae..18de8930b 100644 --- a/modules/m_sasl.cpp +++ b/modules/m_sasl.cpp @@ -52,6 +52,8 @@ class Plain : public Mechanism class External : public Mechanism { + ServiceReference<CertService> certs; + struct Session : SASL::Session { Anope::string cert; @@ -60,7 +62,7 @@ class External : public Mechanism }; public: - External(Module *o) : Mechanism(o, "EXTERNAL") + External(Module *o) : Mechanism(o, "EXTERNAL"), certs("CertService", "certs") { if (!IRCD || !IRCD->CanCertFP) throw ModuleException("No CertFP"); @@ -83,26 +85,22 @@ class External : public Mechanism } else if (m.type == "C") { - Anope::string account; - Anope::B64Decode(m.data, account); - - NickAlias *na = NickAlias::Find(account); - if (!na) + if (!certs) { sasl->Fail(sess); delete sess; return; } - NSCertList *cl = na->nc->GetExt<NSCertList>("certificates"); - if (cl == NULL || !cl->FindCert(mysess->cert)) + NickCore *nc = certs->FindAccountFromCert(mysess->cert); + if (!nc) { sasl->Fail(sess); delete sess; return; } - sasl->Succeed(sess, na->nc); + sasl->Succeed(sess, nc); delete sess; } } |