X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_sasl.cpp;h=e949e3fd4c15c587ae61552b426f3c2d6df59b15;hb=551d687ec6d7ce44be35fae0dd7345fe73c4f63a;hp=b653096b24566361685e7acafe391a4362bbf1db;hpb=553a8da754c8cd308bad2008018849714e70f9b7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index b653096b2..e949e3fd4 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -19,9 +19,10 @@ #include "inspircd.h" -#include "m_cap.h" -#include "account.h" -#include "sasl.h" +#include "modules/cap.h" +#include "modules/account.h" +#include "modules/sasl.h" +#include "modules/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); } @@ -102,7 +112,7 @@ class SaslAuthenticator case SASL_DONE: break; default: - ServerInstance->Logs->Log("m_sasl", DEFAULT, "WTF: SaslState is not a known state (%d)", this->state); + ServerInstance->Logs->Log("m_sasl", LOG_DEFAULT, "WTF: SaslState is not a known state (%d)", this->state); break; } @@ -208,9 +218,9 @@ class CommandSASL : public Command CmdResult Handle(const std::vector& 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()); + ServerInstance->Logs->Log("m_sasl", LOG_DEBUG,"User not found in sasl ENCAP event: %s", parameters[1].c_str()); return CMD_FAILURE; } @@ -239,6 +249,7 @@ class ModuleSASL : public Module GenericCap cap; CommandAuthenticate auth; CommandSASL sasl; + public: ModuleSASL() : authExt("sasl_auth", this), cap(this, "sasl"), auth(this, authExt, cap), sasl(this, authExt) @@ -249,13 +260,13 @@ 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); if (!ServerInstance->Modules->Find("m_services_account.so") || !ServerInstance->Modules->Find("m_cap.so")) - ServerInstance->Logs->Log("m_sasl", DEFAULT, "WARNING: m_services_account.so and m_cap.so are not loaded! m_sasl.so will NOT function correctly until these two modules are loaded!"); + ServerInstance->Logs->Log("m_sasl", LOG_DEFAULT, "WARNING: m_services_account.so and m_cap.so are not loaded! m_sasl.so will NOT function correctly until these two modules are loaded!"); } void OnRehash(User*)