From 4c3329a0ced1a80c8bccce04d7974d060f8a1564 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 6 May 2009 22:46:56 +0000 Subject: Set errno in openssl when handshake fails git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11365 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_ssl_openssl.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 4314ea043..f0a5f9908 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -498,6 +498,7 @@ class ModuleSSLOpenSSL : public Module if (!Handshake(session)) { // Couldn't resume handshake. + errno = session->status == ISSL_CLOSING ? EIO : EAGAIN; return -1; } } @@ -558,6 +559,7 @@ class ModuleSSLOpenSSL : public Module if ((fd < 0) || (fd > ServerInstance->SE->GetMaxFds() - 1)) return 0; + errno = EAGAIN; issl_session* session = &sessions[fd]; if (!session->sess) @@ -574,7 +576,12 @@ class ModuleSSLOpenSSL : public Module // The handshake isn't finished, try to finish it. if (session->rstat == ISSL_WRITE || session->wstat == ISSL_WRITE) { - Handshake(session); + if (!Handshake(session)) + { + // Couldn't resume handshake. + errno = session->status == ISSL_CLOSING ? EIO : EAGAIN; + return -1; + } } } @@ -832,6 +839,7 @@ class ModuleSSLOpenSSL : public Module session->inbuf = NULL; session->sess = NULL; session->status = ISSL_NONE; + errno = EIO; } void VerifyCertificate(issl_session* session, Extensible* user) -- cgit v1.2.3