diff options
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 11 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 3 |
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; |