summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_ssl_openssl.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-07-02 18:17:33 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-07-02 18:17:33 +0000
commit7885a7e6cabe396e2c54eb3192fdbb6afd75c066 (patch)
tree9eeb5141adcf90e8398004722a98c2d3d73fe030 /src/modules/extra/m_ssl_openssl.cpp
parent2db8cb45f87b0406e88f6ecf6a46eb15f5238684 (diff)
Send ssl_cert metadata on signon
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11429 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra/m_ssl_openssl.cpp')
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 6aaf8ab1f..8c35d5d0f 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -776,9 +776,13 @@ class ModuleSSLOpenSSL : public Module
// Tell whatever protocol module we're using that we need to inform other servers of this metadata NOW.
ServerInstance->PI->SendMetaData(user, TYPE_USER, "ssl", "on");
- VerifyCertificate(&sessions[user->GetFd()], user);
+ ssl_cert* certdata = VerifyCertificate(&sessions[user->GetFd()], user);
if (sessions[user->GetFd()].sess)
user->WriteServ("NOTICE %s :*** You are connected using SSL cipher \"%s\"", user->nick.c_str(), SSL_get_cipher(sessions[user->GetFd()].sess));
+
+ ServerInstance->PI->SendMetaData(user, TYPE_USER, "ssl", "ON");
+ if (certdata)
+ ServerInstance->PI->SendMetaData(user, TYPE_USER, "ssl_cert", certdata->GetMetaLine().c_str());
}
}
@@ -822,10 +826,10 @@ class ModuleSSLOpenSSL : public Module
errno = EIO;
}
- void VerifyCertificate(issl_session* session, Extensible* user)
+ ssl_cert* VerifyCertificate(issl_session* session, Extensible* user)
{
if (!session->sess || !user)
- return;
+ return NULL;
X509* cert;
ssl_cert* certinfo = new ssl_cert;
@@ -840,7 +844,7 @@ class ModuleSSLOpenSSL : public Module
if (!cert)
{
certinfo->error = "Could not get peer certificate: "+std::string(get_error());
- return;
+ return certinfo;
}
certinfo->invalid = (SSL_get_verify_result(session->sess) != X509_V_OK);
@@ -874,6 +878,7 @@ class ModuleSSLOpenSSL : public Module
}
X509_free(cert);
+ return certinfo;
}
void Prioritize()