1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/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 :*** No SSL certificate information for this user (%s).", user->nick.c_str(), cert->GetError().c_str());
46 user->WriteServ("NOTICE %s :*** Distinguised Name: %s", user->nick.c_str(), cert->GetDN().c_str());
47 user->WriteServ("NOTICE %s :*** Issuer: %s", user->nick.c_str(), cert->GetIssuer().c_str());
48 user->WriteServ("NOTICE %s :*** Key Fingerprint: %s", user->nick.c_str(), cert->GetFingerprint().c_str());
54 user->WriteServ("NOTICE %s :*** No SSL certificate information for this user.", user->nick.c_str());
59 user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nickname", user->nick.c_str(), parameters[0].c_str());
65 class ModuleSSLInfo : public Module
67 CommandSSLInfo* newcommand;
69 ModuleSSLInfo(InspIRCd* Me)
73 newcommand = new CommandSSLInfo(ServerInstance);
74 ServerInstance->AddCommand(newcommand);
79 virtual ~ModuleSSLInfo()
83 virtual Version GetVersion()
85 return Version("$Id$", VF_VENDOR, API_VERSION);
89 MODULE_INIT(ModuleSSLInfo)