1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
18 #include "transport.h"
22 /* $ModDesc: Provides /sslinfo command used to test who a mask matches */
23 /* $ModDep: transport.h */
27 class cmd_sslinfo : public command_t
30 cmd_sslinfo (InspIRCd* Instance) : command_t(Instance,"SSLINFO", 0, 1)
32 this->source = "m_sslinfo.so";
33 this->syntax = "<nick>";
36 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
38 userrec* target = ServerInstance->FindNick(parameters[0]);
43 if (target->GetExt("ssl_cert", cert))
45 if (cert->GetError().length())
47 user->WriteServ("NOTICE %s :*** Error: %s", user->nick, cert->GetError().c_str());
49 user->WriteServ("NOTICE %s :*** Distinguised Name: %s", user->nick, cert->GetDN().c_str());
50 user->WriteServ("NOTICE %s :*** Issuer: %s", user->nick, cert->GetIssuer().c_str());
51 user->WriteServ("NOTICE %s :*** Key Fingerprint: %s", user->nick, cert->GetFingerprint().c_str());
56 user->WriteServ("NOTICE %s :*** No SSL certificate information for this user.", user->nick);
61 user->WriteServ("401 %s %s :No such nickname", user->nick, parameters[0]);
67 class ModuleSSLInfo : public Module
69 cmd_sslinfo* newcommand;
71 ModuleSSLInfo(InspIRCd* Me)
75 newcommand = new cmd_sslinfo(ServerInstance);
76 ServerInstance->AddCommand(newcommand);
79 void Implements(char* List)
83 virtual ~ModuleSSLInfo()
87 virtual Version GetVersion()
89 return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
94 class ModuleSSLInfoFactory : public ModuleFactory
97 ModuleSSLInfoFactory()
101 ~ModuleSSLInfoFactory()
105 virtual Module * CreateModule(InspIRCd* Me)
107 return new ModuleSSLInfo(Me);
113 extern "C" void * init_module( void )
115 return new ModuleSSLInfoFactory;