mirror of
https://github.com/znc/znc.git
synced 2026-07-04 08:51:14 +02:00
fix state bug when connecting to a remote host thats ssl, results from a hostname that resolves to multiple ip's
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1013 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
+10
-3
@@ -28,7 +28,7 @@
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* $Revision: 1.78 $
|
||||
* $Revision: 1.79 $
|
||||
*/
|
||||
|
||||
#include "Csocket.h"
|
||||
@@ -654,6 +654,10 @@ bool Csock::Connect( const CS_STRING & sBindHost, bool bSkipSetup )
|
||||
{
|
||||
if( m_bSkipConnect )
|
||||
{ // this was already called, so skipping now. this is to allow easy pass through
|
||||
if ( m_eConState != CST_OK )
|
||||
{
|
||||
m_eConState = ( GetSSL() ? CST_CONNECTSSL : CST_OK );
|
||||
}
|
||||
return( true );
|
||||
}
|
||||
// bind to a hostname if requested
|
||||
@@ -725,7 +729,9 @@ bool Csock::Connect( const CS_STRING & sBindHost, bool bSkipSetup )
|
||||
}
|
||||
|
||||
if ( m_eConState != CST_OK )
|
||||
m_eConState = CST_OK;
|
||||
{
|
||||
m_eConState = ( GetSSL() ? CST_CONNECTSSL : CST_OK );
|
||||
}
|
||||
|
||||
return( true );
|
||||
}
|
||||
@@ -1114,7 +1120,6 @@ bool Csock::ConnectSSL( const CS_STRING & sBindhost )
|
||||
if ( m_iReadSock == -1 )
|
||||
if ( !Connect( sBindhost ) )
|
||||
return( false );
|
||||
|
||||
if ( !m_ssl )
|
||||
if ( !SSLClientSetup() )
|
||||
return( false );
|
||||
@@ -1142,6 +1147,8 @@ bool Csock::ConnectSSL( const CS_STRING & sBindhost )
|
||||
set_blocking( m_iReadSock );
|
||||
}
|
||||
|
||||
if ( m_eConState != CST_OK )
|
||||
m_eConState = CST_OK;
|
||||
return( bPass );
|
||||
#else
|
||||
return( false );
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* $Revision: 1.189 $
|
||||
* $Revision: 1.190 $
|
||||
*/
|
||||
|
||||
// note to compile with win32 need to link to winsock2, using gcc its -lws2_32
|
||||
@@ -464,7 +464,8 @@ public:
|
||||
CST_BINDVHOST = 1,
|
||||
CST_DESTDNS = 2,
|
||||
CST_CONNECT = 3,
|
||||
CST_OK = 4
|
||||
CST_CONNECTSSL = 4,
|
||||
CST_OK = 5
|
||||
};
|
||||
|
||||
enum ECloseType
|
||||
@@ -1369,6 +1370,7 @@ public:
|
||||
|
||||
if ( pcSock->GetConState() == T::CST_DESTDNS )
|
||||
{
|
||||
if ( !pcSock->SetupVHost() )
|
||||
if ( pcSock->DNSLookup( T::DNS_DEST ) == ETIMEDOUT )
|
||||
{
|
||||
pcSock->SockError( EADDRNOTAVAIL );
|
||||
@@ -1376,7 +1378,6 @@ public:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ( pcSock->GetConState() == T::CST_CONNECT )
|
||||
{
|
||||
if ( !pcSock->Connect( pcSock->GetBindHost(), true ) )
|
||||
@@ -1389,7 +1390,10 @@ public:
|
||||
DelSock( a-- );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#ifdef HAVE_LIBSSL
|
||||
if( pcSock->GetConState() == T::CST_CONNECTSSL )
|
||||
{
|
||||
if ( pcSock->GetSSL() )
|
||||
{
|
||||
if ( !pcSock->ConnectSSL() )
|
||||
@@ -1403,8 +1407,8 @@ public:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LIBSSL */
|
||||
}
|
||||
#endif /* HAVE_LIBSSL */
|
||||
}
|
||||
|
||||
std::map<T *, EMessages> mpeSocks;
|
||||
|
||||
Reference in New Issue
Block a user