From 5af5707b6dc5d216e9bef043f9a37ae640e46a3e Mon Sep 17 00:00:00 2001 From: danieldg Date: Sat, 27 Jun 2009 21:03:46 +0000 Subject: m_sslinfo does not depend on external libraries, it should not be in extra git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11418 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_sslinfo.cpp | 90 ----------------------------------------- src/modules/m_sslinfo.cpp | 90 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 90 deletions(-) delete mode 100644 src/modules/extra/m_sslinfo.cpp create mode 100644 src/modules/m_sslinfo.cpp (limited to 'src') diff --git a/src/modules/extra/m_sslinfo.cpp b/src/modules/extra/m_sslinfo.cpp deleted file mode 100644 index fb1a00666..000000000 --- a/src/modules/extra/m_sslinfo.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#include "inspircd.h" -#include "transport.h" - -/* $ModDesc: Provides /sslinfo command used to test who a mask matches */ -/* $ModDep: transport.h */ - -/** Handle /SSLINFO - */ -class CommandSSLInfo : public Command -{ - public: - CommandSSLInfo (InspIRCd* Instance) : Command(Instance,"SSLINFO", 0, 1) - { - this->source = "m_sslinfo.so"; - this->syntax = ""; - } - - CmdResult Handle (const std::vector ¶meters, User *user) - { - User* target = ServerInstance->FindNick(parameters[0]); - ssl_cert* cert; - - if (target) - { - if (target->GetExt("ssl_cert", cert)) - { - if (cert->GetError().length()) - { - user->WriteServ("NOTICE %s :*** No SSL certificate information for this user (%s).", user->nick.c_str(), cert->GetError().c_str()); - } - else - { - user->WriteServ("NOTICE %s :*** Distinguised Name: %s", user->nick.c_str(), cert->GetDN().c_str()); - user->WriteServ("NOTICE %s :*** Issuer: %s", user->nick.c_str(), cert->GetIssuer().c_str()); - user->WriteServ("NOTICE %s :*** Key Fingerprint: %s", user->nick.c_str(), cert->GetFingerprint().c_str()); - } - return CMD_LOCALONLY; - } - else - { - user->WriteServ("NOTICE %s :*** No SSL certificate information for this user.", user->nick.c_str()); - return CMD_FAILURE; - } - } - else - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nickname", user->nick.c_str(), parameters[0].c_str()); - - return CMD_FAILURE; - } -}; - -class ModuleSSLInfo : public Module -{ - CommandSSLInfo* newcommand; - public: - ModuleSSLInfo(InspIRCd* Me) - : Module(Me) - { - - newcommand = new CommandSSLInfo(ServerInstance); - ServerInstance->AddCommand(newcommand); - - } - - - virtual ~ModuleSSLInfo() - { - } - - virtual Version GetVersion() - { - return Version("$Id$", VF_VENDOR, API_VERSION); - } -}; - -MODULE_INIT(ModuleSSLInfo) - diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp new file mode 100644 index 000000000..fb1a00666 --- /dev/null +++ b/src/modules/m_sslinfo.cpp @@ -0,0 +1,90 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#include "inspircd.h" +#include "transport.h" + +/* $ModDesc: Provides /sslinfo command used to test who a mask matches */ +/* $ModDep: transport.h */ + +/** Handle /SSLINFO + */ +class CommandSSLInfo : public Command +{ + public: + CommandSSLInfo (InspIRCd* Instance) : Command(Instance,"SSLINFO", 0, 1) + { + this->source = "m_sslinfo.so"; + this->syntax = ""; + } + + CmdResult Handle (const std::vector ¶meters, User *user) + { + User* target = ServerInstance->FindNick(parameters[0]); + ssl_cert* cert; + + if (target) + { + if (target->GetExt("ssl_cert", cert)) + { + if (cert->GetError().length()) + { + user->WriteServ("NOTICE %s :*** No SSL certificate information for this user (%s).", user->nick.c_str(), cert->GetError().c_str()); + } + else + { + user->WriteServ("NOTICE %s :*** Distinguised Name: %s", user->nick.c_str(), cert->GetDN().c_str()); + user->WriteServ("NOTICE %s :*** Issuer: %s", user->nick.c_str(), cert->GetIssuer().c_str()); + user->WriteServ("NOTICE %s :*** Key Fingerprint: %s", user->nick.c_str(), cert->GetFingerprint().c_str()); + } + return CMD_LOCALONLY; + } + else + { + user->WriteServ("NOTICE %s :*** No SSL certificate information for this user.", user->nick.c_str()); + return CMD_FAILURE; + } + } + else + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nickname", user->nick.c_str(), parameters[0].c_str()); + + return CMD_FAILURE; + } +}; + +class ModuleSSLInfo : public Module +{ + CommandSSLInfo* newcommand; + public: + ModuleSSLInfo(InspIRCd* Me) + : Module(Me) + { + + newcommand = new CommandSSLInfo(ServerInstance); + ServerInstance->AddCommand(newcommand); + + } + + + virtual ~ModuleSSLInfo() + { + } + + virtual Version GetVersion() + { + return Version("$Id$", VF_VENDOR, API_VERSION); + } +}; + +MODULE_INIT(ModuleSSLInfo) + -- cgit v1.2.3