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
30 cmd_sslinfo (InspIRCd* Instance) : Command(Instance,"SSLINFO", 0, 1)
32 this->source = "m_sslinfo.so";
33 this->syntax = "<nick>";
36 CmdResult Handle (const char** parameters, int pcnt, User *user)
38 User* 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);
80 void Implements(char* List)
84 virtual ~ModuleSSLInfo()
88 virtual Version GetVersion()
90 return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
94 MODULE_INIT(ModuleSSLInfo)