summaryrefslogtreecommitdiff
path: root/src/modules/extra
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-03-22 18:55:37 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-03-22 18:55:37 +0000
commit9769b27a2f3fcfb49bb84ff1f4a8275c8dc75a9c (patch)
treefa30af3c9ebe1e5d67a9856e3230ac3f13719cc3 /src/modules/extra
parent3c68d83766d0eea30ed70888e537a1deb4c309ff (diff)
Some tweaks for gnutls
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6696 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra')
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp11
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp3
2 files changed, 11 insertions, 3 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index c9a421e39..8847d5c0d 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -374,12 +374,11 @@ class ModuleSSLGnuTLS : public Module
gnutls_set_default_priority(session->sess); // Avoid calling all the priority functions, defaults are adequate.
gnutls_credentials_set(session->sess, GNUTLS_CRD_CERTIFICATE, x509_cred);
- //TODO: Request server cert here.
- //gnutls_certificate_request(session->sess, GNUTLS_CERT_REQUEST); // Request server certificate if any.
gnutls_dh_set_prime_bits(session->sess, dh_bits);
-
gnutls_transport_set_ptr(session->sess, (gnutls_transport_ptr_t) fd); // Give gnutls the fd for the socket.
+ gnutls_certificate_request(session->sess, GNUTLS_CERT_REQUEST); // Request server certificate if any.
+
Handshake(session);
}
@@ -442,7 +441,10 @@ class ModuleSSLGnuTLS : public Module
else if (ret < 0)
{
if (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)
+ {
+ errno = EAGAIN;
return -1;
+ }
else
{
readresult = 0;
@@ -675,6 +677,9 @@ class ModuleSSLGnuTLS : public Module
void VerifyCertificate(issl_session* session, Extensible* user)
{
+ if (!session->sess || !user)
+ return;
+
unsigned int status;
const gnutls_datum_t* cert_list;
int ret;
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 6e2b713f9..9ced3a246 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -775,6 +775,9 @@ class ModuleSSLOpenSSL : public Module
void VerifyCertificate(issl_session* session, Extensible* user)
{
+ if (!session->sess || !user)
+ return;
+
X509* cert;
ssl_cert* certinfo = new ssl_cert;
unsigned int n;