diff options
| author | 2016-04-28 17:10:10 +0200 | |
|---|---|---|
| committer | 2016-04-28 17:10:10 +0200 | |
| commit | e7e9f350ac3bda43ba297160a09f8d04a06cfc6f (patch) | |
| tree | 9589e4c1b22c25221c2b8ba6638152d2df286cc4 /src/modules/m_sslinfo.cpp | |
| parent | Export the GetCiphersuite() method from the SSL modules (diff) | |
Deduplicate code for on connect SSL ciphersuite NOTICE by moving it into m_sslinfo
Diffstat (limited to 'src/modules/m_sslinfo.cpp')
| -rw-r--r-- | src/modules/m_sslinfo.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 6a29d3bde..9682e92cf 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -209,8 +209,26 @@ class ModuleSSLInfo : public Module, public Whois::EventListener void OnPostConnect(User* user) CXX11_OVERRIDE { - ssl_cert *cert = cmd.CertExt.get(user); - if (!cert || cert->fingerprint.empty()) + LocalUser* const localuser = IS_LOCAL(user); + if (!localuser) + return; + + const SSLIOHook* const ssliohook = SSLIOHook::IsSSL(&localuser->eh); + if (!ssliohook) + return; + + ssl_cert* const cert = ssliohook->GetCertificate(); + + { + std::string text = "*** You are connected using SSL cipher '"; + ssliohook->GetCiphersuite(text); + text.push_back('\''); + if ((cert) && (!cert->GetFingerprint().empty())) + text.append(" and your SSL certificate fingerprint is ").append(cert->GetFingerprint()); + user->WriteNotice(text); + } + + if (!cert) return; // find an auto-oper block for this user for (ServerConfig::OperIndex::const_iterator i = ServerInstance->Config->oper_blocks.begin(); i != ServerInstance->Config->oper_blocks.end(); ++i) |
