From: <ps...@us...> - 2009-09-02 17:26:18
|
Revision: 1615 http://znc.svn.sourceforge.net/znc/?rev=1615&view=rev Author: psychon Date: 2009-09-02 17:26:06 +0000 (Wed, 02 Sep 2009) Log Message: ----------- Update to latest Csocket Modified Paths: -------------- trunk/Csocket.cpp trunk/Csocket.h Modified: trunk/Csocket.cpp =================================================================== --- trunk/Csocket.cpp 2009-09-02 17:22:34 UTC (rev 1614) +++ trunk/Csocket.cpp 2009-09-02 17:26:06 UTC (rev 1615) @@ -28,7 +28,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * -* $Revision: 1.99 $ +* $Revision: 1.104 $ */ #include "Csocket.h" @@ -619,7 +619,6 @@ FREE_CTX(); // be sure to remove anything that was already here m_ssl = cCopy.m_ssl; m_ssl_ctx = cCopy.m_ssl_ctx; - m_ssl_method = cCopy.m_ssl_method; m_pCerVerifyCB = cCopy.m_pCerVerifyCB; @@ -990,8 +989,8 @@ switch( m_iMethod ) { case SSL2: - m_ssl_method = SSLv2_client_method(); - if ( !m_ssl_method ) + m_ssl_ctx = SSL_CTX_new ( SSLv2_client_method() ); + if ( !m_ssl_ctx ) { CS_DEBUG( "WARNING: MakeConnection .... SSLv2_client_method failed!" ); return( false ); @@ -999,16 +998,16 @@ break; case SSL3: - m_ssl_method = SSLv3_client_method(); - if ( !m_ssl_method ) + m_ssl_ctx = SSL_CTX_new ( SSLv3_client_method() ); + if ( !m_ssl_ctx ) { CS_DEBUG( "WARNING: MakeConnection .... SSLv3_client_method failed!" ); return( false ); } break; case TLS1: - m_ssl_method = TLSv1_client_method(); - if ( !m_ssl_method ) + m_ssl_ctx = SSL_CTX_new ( TLSv1_client_method() ); + if ( !m_ssl_ctx ) { CS_DEBUG( "WARNING: MakeConnection .... TLSv1_client_method failed!" ); return( false ); @@ -1016,8 +1015,8 @@ break; case SSL23: default: - m_ssl_method = SSLv23_client_method(); - if ( !m_ssl_method ) + m_ssl_ctx = SSL_CTX_new ( SSLv23_client_method() ); + if ( !m_ssl_ctx ) { CS_DEBUG( "WARNING: MakeConnection .... SSLv23_client_method failed!" ); return( false ); @@ -1025,10 +1024,6 @@ break; } - // wrap some warnings in here - m_ssl_ctx = SSL_CTX_new ( m_ssl_method ); - if ( !m_ssl_ctx ) - return( false ); SSL_CTX_set_default_verify_paths( m_ssl_ctx ); @@ -1079,8 +1074,8 @@ switch( m_iMethod ) { case SSL2: - m_ssl_method = SSLv2_server_method(); - if ( !m_ssl_method ) + m_ssl_ctx = SSL_CTX_new ( SSLv2_server_method() ); + if ( !m_ssl_ctx ) { CS_DEBUG( "WARNING: MakeConnection .... SSLv2_server_method failed!" ); return( false ); @@ -1088,8 +1083,8 @@ break; case SSL3: - m_ssl_method = SSLv3_server_method(); - if ( !m_ssl_method ) + m_ssl_ctx = SSL_CTX_new ( SSLv3_server_method() ); + if ( !m_ssl_ctx ) { CS_DEBUG( "WARNING: MakeConnection .... SSLv3_server_method failed!" ); return( false ); @@ -1097,8 +1092,8 @@ break; case TLS1: - m_ssl_method = TLSv1_server_method(); - if ( !m_ssl_method ) + m_ssl_ctx = SSL_CTX_new ( TLSv1_server_method() ); + if ( !m_ssl_ctx ) { CS_DEBUG( "WARNING: MakeConnection .... TLSv1_server_method failed!" ); return( false ); @@ -1107,8 +1102,8 @@ case SSL23: default: - m_ssl_method = SSLv23_server_method(); - if ( !m_ssl_method ) + m_ssl_ctx = SSL_CTX_new ( SSLv23_server_method() ); + if ( !m_ssl_ctx ) { CS_DEBUG( "WARNING: MakeConnection .... SSLv23_server_method failed!" ); return( false ); @@ -1116,10 +1111,6 @@ break; } - // wrap some warnings in here - m_ssl_ctx = SSL_CTX_new ( m_ssl_method ); - if ( !m_ssl_ctx ) - return( false ); SSL_CTX_set_default_verify_paths( m_ssl_ctx ); // set the pemfile password @@ -1134,7 +1125,7 @@ // // set up the CTX - if ( SSL_CTX_use_certificate_file( m_ssl_ctx, m_sPemFile.c_str() , SSL_FILETYPE_PEM ) <= 0 ) + if ( SSL_CTX_use_certificate_chain_file( m_ssl_ctx, m_sPemFile.c_str() ) <= 0 ) { CS_DEBUG( "Error with PEM file [" << m_sPemFile << "]" ); SSLErrors( __FILE__, __LINE__ ); @@ -1715,7 +1706,7 @@ if( !GetIPv6() ) { struct sockaddr_in mLocalAddr; - socklen_t mLocalLen = sizeof( mLocalLen ); + socklen_t mLocalLen = sizeof( mLocalAddr ); if ( getsockname( iSock, (struct sockaddr *) &mLocalAddr, &mLocalLen ) == 0 ) m_iLocalPort = ntohs( mLocalAddr.sin_port ); } @@ -1723,7 +1714,7 @@ else { struct sockaddr_in6 mLocalAddr; - socklen_t mLocalLen = sizeof( mLocalLen ); + socklen_t mLocalLen = sizeof( mLocalAddr ); if ( getsockname( iSock, (struct sockaddr *) &mLocalAddr, &mLocalLen ) == 0 ) m_iLocalPort = ntohs( mLocalAddr.sin6_port ); } @@ -2056,9 +2047,8 @@ if( !CreateSocksFD() ) { m_iDNSTryCount = 0; - return ETIMEDOUT; + return( ETIMEDOUT ); } - if ( m_eConState != CST_OK ) m_eConState = ( ( eDNSLType == DNS_VHOST ) ? CST_BINDVHOST : CST_CONNECT ); m_iDNSTryCount = 0; Modified: trunk/Csocket.h =================================================================== --- trunk/Csocket.h 2009-09-02 17:22:34 UTC (rev 1614) +++ trunk/Csocket.h 2009-09-02 17:26:06 UTC (rev 1615) @@ -28,7 +28,7 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * -* $Revision: 1.209 $ +* $Revision: 1.211 $ */ // note to compile with win32 need to link to winsock2, using gcc its -lws2_32 @@ -592,8 +592,8 @@ void SetSock( int iSock ); int & GetSock(); - //! resets the time counter - void ResetTimer(); + //! resets the time counter, this is virtual in the event you need an event on the timer being Reset + virtual void ResetTimer(); //! will pause/unpause reading on this socket void PauseRead(); @@ -990,7 +990,6 @@ CS_STRING m_sSSLBuffer; SSL *m_ssl; SSL_CTX *m_ssl_ctx; - SSL_METHOD *m_ssl_method; unsigned int m_iRequireClientCertFlags; FPCertVerifyCB m_pCerVerifyCB; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |