Skip to content

Commit

Permalink
Csocket: Compile when SSLv2 is disabled in openssl
Browse files Browse the repository at this point in the history
Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information
psychon committed Apr 15, 2011
1 parent b8b6563 commit e0c5c3b
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions Csocket.cpp
Expand Up @@ -1109,15 +1109,6 @@ bool Csock::SSLClientSetup()

switch( m_iMethod )
{
case SSL2:
m_ssl_ctx = SSL_CTX_new ( SSLv2_client_method() );
if ( !m_ssl_ctx )
{
CS_DEBUG( "WARNING: MakeConnection .... SSLv2_client_method failed!" );
return( false );
}
break;

case SSL3:
m_ssl_ctx = SSL_CTX_new ( SSLv3_client_method() );
if ( !m_ssl_ctx )
Expand All @@ -1134,6 +1125,17 @@ bool Csock::SSLClientSetup()
return( false );
}
break;
case SSL2:
#ifndef OPENSSL_NO_SSL2
m_ssl_ctx = SSL_CTX_new ( SSLv2_client_method() );
if ( !m_ssl_ctx )
{
CS_DEBUG( "WARNING: MakeConnection .... SSLv2_client_method failed!" );
return( false );
}
break;
#endif
/* Fall through if SSL2 is disabled */
case SSL23:
default:
m_ssl_ctx = SSL_CTX_new ( SSLv23_client_method() );
Expand Down Expand Up @@ -1204,15 +1206,6 @@ bool Csock::SSLServerSetup()

switch( m_iMethod )
{
case SSL2:
m_ssl_ctx = SSL_CTX_new ( SSLv2_server_method() );
if ( !m_ssl_ctx )
{
CS_DEBUG( "WARNING: MakeConnection .... SSLv2_server_method failed!" );
return( false );
}
break;

case SSL3:
m_ssl_ctx = SSL_CTX_new ( SSLv3_server_method() );
if ( !m_ssl_ctx )
Expand All @@ -1230,7 +1223,17 @@ bool Csock::SSLServerSetup()
return( false );
}
break;

#ifndef OPENSSL_NO_SSL2
case SSL2:
m_ssl_ctx = SSL_CTX_new ( SSLv2_server_method() );
if ( !m_ssl_ctx )
{
CS_DEBUG( "WARNING: MakeConnection .... SSLv2_server_method failed!" );
return( false );
}
break;
#endif
/* Fall through if SSL2 is disabled */
case SSL23:
default:
m_ssl_ctx = SSL_CTX_new ( SSLv23_server_method() );
Expand Down

0 comments on commit e0c5c3b

Please sign in to comment.