diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-13 20:30:25 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-13 20:30:25 +0000 |
commit | 6d57bbe05c31c79eaad02fe81cfb9c1ed6b79c58 (patch) | |
tree | e0c89ed36b00f4c2925d7f39c32a835657b0fa6e /src/modules/m_sslmodes.cpp | |
parent | 7eea21b8d43b0d5993e88b62d9d4894c2af49303 (diff) |
Change Extensible to use strongly typed entries
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11696 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_sslmodes.cpp')
-rw-r--r-- | src/modules/m_sslmodes.cpp | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index b19347ea7..a07252069 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -12,11 +12,10 @@ */ #include "inspircd.h" +#include "transport.h" /* $ModDesc: Provides support for unreal-style channel mode +z */ -static char* dummy; - /** Handle channel mode +z */ class SSLMode : public ModeHandler @@ -35,7 +34,9 @@ class SSLMode : public ModeHandler CUList* userlist = channel->GetUsers(); for(CUList::iterator i = userlist->begin(); i != userlist->end(); i++) { - if(!i->first->GetExt("ssl", dummy) && !ServerInstance->ULine(i->first->server)) + BufferedSocketCertificateRequest req(i->first, creator, i->first->GetIOHook()); + req.Send(); + if(!req.cert && !ServerInstance->ULine(i->first->server)) { source->WriteNumeric(ERR_ALLMUSTSSL, "%s %s :all members of the channel must be connected via SSL", source->nick.c_str(), channel->name.c_str()); return MODEACTION_DENY; @@ -74,16 +75,17 @@ class ModuleSSLModes : public Module { if (!ServerInstance->Modes->AddMode(&sslm)) throw ModuleException("Could not add new modes!"); - Implementation eventlist[] = { I_OnUserPreJoin }; - ServerInstance->Modules->Attach(eventlist, this, 1); + Implementation eventlist[] = { I_OnUserPreJoin, I_OnCheckBan, I_On005Numeric }; + ServerInstance->Modules->Attach(eventlist, this, 3); } - - virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) + ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven) { if(chan && chan->IsModeSet('z')) { - if(user->GetExt("ssl", dummy)) + BufferedSocketCertificateRequest req(user, this, user->GetIOHook()); + req.Send(); + if (req.cert) { // Let them in return MOD_RES_PASSTHRU; @@ -99,12 +101,26 @@ class ModuleSSLModes : public Module return MOD_RES_PASSTHRU; } - virtual ~ModuleSSLModes() + ModResult OnCheckBan(User *user, Channel *c) + { + BufferedSocketCertificateRequest req(user, this, user->GetIOHook()); + req.Send(); + if (req.cert) + return c->GetExtBanStatus(req.cert->GetFingerprint(), 'z'); + return MOD_RES_PASSTHRU; + } + + ~ModuleSSLModes() { ServerInstance->Modes->DelMode(&sslm); } - virtual Version GetVersion() + void On005Numeric(std::string &output) + { + ServerInstance->AddExtBanChar('z'); + } + + Version GetVersion() { return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION); } |