X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_sslinfo.cpp;h=76fc6ebf062ded015ddaf00f9f2480a73e72b7ac;hb=9c4cc196c073145d4ad2ae92fb2be2194cf621f4;hp=1a4b5c9a2e8e9419331e102bbe3a9f80c6c93772;hpb=91e0af0fc4889f20d2f63426f8fe379674fc0393;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 1a4b5c9a2..76fc6ebf0 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -20,6 +20,15 @@ #include "inspircd.h" #include "modules/ssl.h" +enum +{ + // From oftc-hybrid. + RPL_WHOISCERTFP = 276, + + // From UnrealIRCd. + RPL_WHOISSECURE = 671 +}; + class SSLCertExt : public ExtensionItem { public: SSLCertExt(Module* parent) @@ -162,10 +171,10 @@ class ModuleSSLInfo : public Module, public Whois::EventListener ssl_cert* cert = cmd.CertExt.get(whois.GetTarget()); if (cert) { - whois.SendLine(671, "is using a secure connection"); + whois.SendLine(RPL_WHOISSECURE, "is using a secure connection"); bool operonlyfp = ServerInstance->Config->ConfValue("sslinfo")->getBool("operonly"); if ((!operonlyfp || whois.IsSelfWhois() || whois.GetSource()->IsOper()) && !cert->fingerprint.empty()) - whois.SendLine(276, InspIRCd::Format("has client certificate fingerprint %s", cert->fingerprint.c_str())); + whois.SendLine(RPL_WHOISCERTFP, InspIRCd::Format("has client certificate fingerprint %s", cert->fingerprint.c_str())); } } @@ -181,7 +190,7 @@ class ModuleSSLInfo : public Module, public Whois::EventListener if (ifo->oper_block->getBool("sslonly") && !cert) { - user->WriteNumeric(491, "This oper login requires an SSL connection."); + user->WriteNumeric(ERR_NOOPERHOST, "This oper login requires an SSL connection."); user->CommandFloodPenalty += 10000; return MOD_RES_DENY; } @@ -189,7 +198,7 @@ class ModuleSSLInfo : public Module, public Whois::EventListener std::string fingerprint; if (ifo->oper_block->readString("fingerprint", fingerprint) && (!cert || cert->GetFingerprint() != fingerprint)) { - user->WriteNumeric(491, "This oper login requires a matching SSL certificate fingerprint."); + user->WriteNumeric(ERR_NOOPERHOST, "This oper login requires a matching SSL certificate fingerprint."); user->CommandFloodPenalty += 10000; return MOD_RES_DENY; } @@ -250,10 +259,12 @@ class ModuleSSLInfo : public Module, public Whois::EventListener if (myclass->config->getString("requiressl") == "trusted") { ok = (cert && cert->IsCAVerified()); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Class requires a trusted SSL cert. Client %s one.", (ok ? "has" : "does not have")); } else if (myclass->config->getBool("requiressl")) { ok = (cert != NULL); + ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Class requires any SSL cert. Client %s one.", (ok ? "has" : "does not have")); } if (!ok)