summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2021-02-01 12:59:06 +0000
committerSadie Powell <sadie@witchery.services>2021-02-01 12:59:06 +0000
commitff06be6c442359aa223aa68c43d1d8c41920fb91 (patch)
tree5efc9249f2923534db01cfe9ec0ded0d0ef9e0b2 /src
parent55a0a6ab66739fae65d123fadff1a31d96999c16 (diff)
Read <sslinfo:operonly> once at load time.
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_sslinfo.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index bbbc9ba64..3ced2bc8b 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -148,6 +148,7 @@ class CommandSSLInfo : public Command
{
public:
UserCertificateAPIImpl sslapi;
+ bool operonlyfp;
CommandSSLInfo(Module* Creator)
: Command(Creator, "SSLINFO", 1)
@@ -166,7 +167,6 @@ class CommandSSLInfo : public Command
return CMD_FAILURE;
}
- bool operonlyfp = ServerInstance->Config->ConfValue("sslinfo")->getBool("operonly");
if (operonlyfp && !user->IsOper() && target != user)
{
user->WriteNotice("*** You cannot view TLS (SSL) client certificate information for other users");
@@ -217,6 +217,12 @@ class ModuleSSLInfo
{
}
+ void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
+ {
+ ConfigTag* tag = ServerInstance->Config->ConfValue("sslinfo");
+ cmd.operonlyfp = tag->getBool("operonly");
+ }
+
Version GetVersion() CXX11_OVERRIDE
{
return Version("Adds user facing TLS (SSL) information, various TLS (SSL) configuration options, and the /SSLINFO command to look up TLS (SSL) certificate information for other users.", VF_VENDOR);
@@ -228,8 +234,7 @@ class ModuleSSLInfo
if (cert)
{
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())
+ if ((!cmd.operonlyfp || whois.IsSelfWhois() || whois.GetSource()->IsOper()) && !cert->fingerprint.empty())
whois.SendLine(RPL_WHOISCERTFP, InspIRCd::Format("has TLS (SSL) client certificate fingerprint %s", cert->fingerprint.c_str()));
}
}