]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sasl.cpp
Fix m_randquote with 0 quotes
[user/henk/code/inspircd.git] / src / modules / m_sasl.cpp
index b653096b24566361685e7acafe391a4362bbf1db..f8d8c5322d26788da4d6aae37bf3a478c5a39010 100644 (file)
@@ -22,6 +22,7 @@
 #include "m_cap.h"
 #include "account.h"
 #include "sasl.h"
+#include "ssl.h"
 
 /* $ModDesc: Provides support for IRC Authentication Layer (aka: atheme SASL) via AUTHENTICATE. */
 
@@ -62,6 +63,15 @@ class SaslAuthenticator
                params.push_back("S");
                params.push_back(method);
 
+               if (method == "EXTERNAL" && IS_LOCAL(user_))
+               {
+                       SocketCertificateRequest req(&((LocalUser*)user_)->eh, ServerInstance->Modules->Find("m_sasl.so"));
+                       std::string fp = req.GetFingerprint();
+
+                       if (fp.size())
+                               params.push_back(fp);
+               }
+
                SendSASL(params);
        }
 
@@ -208,7 +218,7 @@ class CommandSASL : public Command
        CmdResult Handle(const std::vector<std::string>& parameters, User *user)
        {
                User* target = ServerInstance->FindNick(parameters[1]);
-               if (!target)
+               if ((!target) || (IS_SERVER(target)))
                {
                        ServerInstance->Logs->Log("m_sasl", DEBUG,"User not found in sasl ENCAP event: %s", parameters[1].c_str());
                        return CMD_FAILURE;
@@ -249,7 +259,7 @@ class ModuleSASL : public Module
        {
                OnRehash(NULL);
                Implementation eventlist[] = { I_OnEvent, I_OnUserRegister, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, 3);
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
 
                ServiceProvider* providelist[] = { &auth, &sasl, &authExt };
                ServerInstance->Modules->AddServices(providelist, 3);