summaryrefslogtreecommitdiff
path: root/src/modules/m_sslinfo.cpp
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-11-03 15:43:04 +0000
committerSadie Powell <sadie@witchery.services>2020-11-03 15:43:04 +0000
commit0a6b1e1a7de92e078a98f0b955d2624e5b85e4c1 (patch)
tree203e657ce7177250199923504f53d5f214efe454 /src/modules/m_sslinfo.cpp
parentd38595e7e14e7509e744d33df657d50d00cc201f (diff)
Make connect class debug logging more complete and consistent.
Diffstat (limited to 'src/modules/m_sslinfo.cpp')
-rw-r--r--src/modules/m_sslinfo.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index 70e065257..0054e3ed7 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -318,21 +318,25 @@ class ModuleSSLInfo
ModResult OnSetConnectClass(LocalUser* user, ConnectClass* myclass) CXX11_OVERRIDE
{
ssl_cert* cert = cmd.sslapi.GetCertificate(user);
- bool ok = true;
+ const char* error = NULL;
const std::string requiressl = myclass->config->getString("requiressl");
if (stdalgo::string::equalsci(requiressl, "trusted"))
{
- ok = (cert && cert->IsCAVerified());
- ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Class requires a trusted TLS (SSL) client certificate. Client %s one.", (ok ? "has" : "does not have"));
+ if (!cert || !cert->IsCAVerified())
+ error = "a trusted TLS (SSL) client certificate";
}
else if (myclass->config->getBool("requiressl"))
{
- ok = (cert != NULL);
- ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "Class requires a secure connection. Client %s on a secure connection.", (ok ? "is" : "is not"));
+ if (!cert)
+ error = "a TLS (SSL) connection";
}
- if (!ok)
+ if (error)
+ {
+ ServerInstance->Logs->Log("CONNECTCLASS", LOG_DEBUG, "The %s connect class is not suitable as it requires %s",
+ myclass->GetName().c_str(), error);
return MOD_RES_DENY;
+ }
return MOD_RES_PASSTHRU;
}