mirror of
https://github.com/inspircd/inspircd.git
synced 2025-04-23 00:11:28 -04:00
Some tweaks for gnutls
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6696 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
3c68d83766
commit
9769b27a2f
@ -374,12 +374,11 @@ class ModuleSSLGnuTLS : public Module
|
|||||||
|
|
||||||
gnutls_set_default_priority(session->sess); // Avoid calling all the priority functions, defaults are adequate.
|
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);
|
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_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_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);
|
Handshake(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,7 +441,10 @@ class ModuleSSLGnuTLS : public Module
|
|||||||
else if (ret < 0)
|
else if (ret < 0)
|
||||||
{
|
{
|
||||||
if (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)
|
if (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)
|
||||||
|
{
|
||||||
|
errno = EAGAIN;
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
readresult = 0;
|
readresult = 0;
|
||||||
@ -675,6 +677,9 @@ class ModuleSSLGnuTLS : public Module
|
|||||||
|
|
||||||
void VerifyCertificate(issl_session* session, Extensible* user)
|
void VerifyCertificate(issl_session* session, Extensible* user)
|
||||||
{
|
{
|
||||||
|
if (!session->sess || !user)
|
||||||
|
return;
|
||||||
|
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
const gnutls_datum_t* cert_list;
|
const gnutls_datum_t* cert_list;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -775,6 +775,9 @@ class ModuleSSLOpenSSL : public Module
|
|||||||
|
|
||||||
void VerifyCertificate(issl_session* session, Extensible* user)
|
void VerifyCertificate(issl_session* session, Extensible* user)
|
||||||
{
|
{
|
||||||
|
if (!session->sess || !user)
|
||||||
|
return;
|
||||||
|
|
||||||
X509* cert;
|
X509* cert;
|
||||||
ssl_cert* certinfo = new ssl_cert;
|
ssl_cert* certinfo = new ssl_cert;
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user