1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 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 * ---------------------------------------------------
15 #include "transport.h"
17 /* $ModDesc: Provides /sslinfo command used to test who a mask matches */
18 /* $ModDep: transport.h */
22 class CommandSSLInfo : public Command
25 CommandSSLInfo (InspIRCd* Instance) : Command(Instance,"SSLINFO", 0, 1)
27 this->source = "m_sslinfo.so";
28 this->syntax = "<nick>";
31 CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
33 User* target = ServerInstance->FindNick(parameters[0]);
38 if (target->GetExt("ssl_cert", cert))
40 if (cert->GetError().length())
42 user->WriteServ("NOTICE %s :*** Error: %s", user->nick.c_str(), cert->GetError().c_str());
44 user->WriteServ("NOTICE %s :*** Distinguised Name: %s", user->nick.c_str(), cert->GetDN().c_str());
45 user->WriteServ("NOTICE %s :*** Issuer: %s", user->nick.c_str(), cert->GetIssuer().c_str());
46 user->WriteServ("NOTICE %s :*** Key Fingerprint: %s", user->nick.c_str(), cert->GetFingerprint().c_str());
51 user->WriteServ("NOTICE %s :*** No SSL certificate information for this user.", user->nick.c_str());
56 user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nickname", user->nick.c_str(), parameters[0].c_str());
62 class ModuleSSLInfo : public Module
64 CommandSSLInfo* newcommand;
66 ModuleSSLInfo(InspIRCd* Me)
70 newcommand = new CommandSSLInfo(ServerInstance);
71 ServerInstance->AddCommand(newcommand);
76 virtual ~ModuleSSLInfo()
80 virtual Version GetVersion()
82 return Version("$Id$", VF_VENDOR, API_VERSION);
86 MODULE_INIT(ModuleSSLInfo)