Invalidate a SSLSocket in constructor if building a new SSL context fails.

git-svn-id: http://voip.null.ro/svn/yate@6498 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
oana 2021-06-01 14:00:14 +00:00
parent 5be2b0ed22
commit dc80401cbb
1 changed files with 6 additions and 0 deletions

View File

@ -423,6 +423,12 @@ SslSocket::SslSocket(SOCKET handle, bool server, int verify, SslContext* context
context ? context->c_str() : "",this);
if (Socket::valid()) {
m_ssl = ::SSL_new(context ? *context : s_context);
if (!m_ssl) {
Debug(&__plugin,DebugNote,"SslSocket::SslSocket(%d) could not create SSL context, terminating [%p]",
handle,this);
Socket::terminate();
return;
}
if (s_index >= 0)
::SSL_set_ex_data(m_ssl,s_index,this);
::SSL_set_verify(m_ssl,verify,0);