summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_ssl_openssl.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-05-06 22:46:56 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-05-06 22:46:56 +0000
commit4c3329a0ced1a80c8bccce04d7974d060f8a1564 (patch)
tree3712ff9b47dcf8b9325becb11a508de82f16cbff /src/modules/extra/m_ssl_openssl.cpp
parent71f7e47bcd7b72d7999daa9f061c8850b5a6521b (diff)
Set errno in openssl when handshake fails
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11365 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra/m_ssl_openssl.cpp')
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp10
1 files changed, 9 insertions, 1 deletions
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)