]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ssl_oper_cert.cpp
Handle file not found, and tidy up the perl.
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_oper_cert.cpp
index ed4ba9c003d48a365f0266064c420d8a8c55c9b3..571dcad06eb5882801e898bd1534832412d90159 100644 (file)
 /* $ModDep: transport.h */
 
 #include "inspircd.h"
-#include "inspircd_config.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 #include "transport.h"
-#include "wildcard.h"
 
 /** Handle /FINGERPRINT
  */
-class cmd_fingerprint : public Command
+class CommandFingerprint : public Command
 {
  public:
-       cmd_fingerprint (InspIRCd* Instance) : Command(Instance,"FINGERPRINT", 0, 1)
+       CommandFingerprint (InspIRCd* Instance) : Command(Instance,"FINGERPRINT", 0, 1)
        {
                this->source = "m_ssl_oper_cert.so";
                syntax = "<nickname>";
-       }       
-                 
+       }
+
        CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
                User* target = ServerInstance->FindNick(parameters[0]);
@@ -72,14 +67,14 @@ class ModuleOperSSLCert : public Module
 {
        ssl_cert* cert;
        bool HasCert;
-       cmd_fingerprint* mycommand;
+       CommandFingerprint* mycommand;
        ConfigReader* cf;
  public:
 
        ModuleOperSSLCert(InspIRCd* Me)
                : Module(Me)
        {
-               mycommand = new cmd_fingerprint(ServerInstance);
+               mycommand = new CommandFingerprint(ServerInstance);
                ServerInstance->AddCommand(mycommand);
                cf = new ConfigReader(ServerInstance);
                Implementation eventlist[] = { I_OnPreCommand, I_OnRehash };
@@ -104,7 +99,7 @@ class ModuleOperSSLCert : public Module
                std::string xhost;
                while (hl >> xhost)
                {
-                       if (match(host, xhost) || match(ip, xhost, true))
+                       if (InspIRCd::Match(host, xhost, ascii_case_insensitive_map) || InspIRCd::MatchCIDR(ip, xhost, ascii_case_insensitive_map))
                        {
                                return true;
                        }
@@ -115,7 +110,7 @@ class ModuleOperSSLCert : public Module
        virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
        {
                irc::string cmd = command.c_str();
-               
+
                if ((cmd == "OPER") && (validated))
                {
                        char TheHost[MAXBUF];
@@ -153,7 +148,7 @@ class ModuleOperSSLCert : public Module
                                if (!OneOfMatches(TheHost, TheIP, HostName.c_str()))
                                        continue;
 
-                               if (Password.length() && !ServerInstance->PassCompare(user, Password.c_str(),parameters[1].c_str(), HashType.c_str()))
+                               if (Password.length() && ServerInstance->PassCompare(user, Password.c_str(),parameters[1].c_str(), HashType.c_str()))
                                        continue;
 
                                if (SSLOnly && !user->GetExt("ssl", dummy))
@@ -181,7 +176,7 @@ class ModuleOperSSLCert : public Module
 
        virtual Version GetVersion()
        {
-               return Version(1,2,0,0,VF_VENDOR,API_VERSION);
+               return Version("$Id$", VF_VENDOR, API_VERSION);
        }
 };