Skip to content

Commit

Permalink
[XrdCl/XrdTls] Handle correctly TLS hand-shake flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal authored and osschar committed Oct 10, 2019
1 parent 4e6908b commit 8c0e5b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/XrdCl/XrdClTls.cc
Expand Up @@ -64,7 +64,7 @@ namespace XrdCl
if( error == XrdTls::TLS_WantWrite )
{
Status st = pSocketHandler->EnableUplink();
if( !st.IsOK() ) status = st;
if( !st.IsOK() ) return st;
}
//----------------------------------------------------------------------
// Otherwise disable uplink
Expand All @@ -76,7 +76,7 @@ namespace XrdCl
}
}

return Status();
return status;
}

Status Tls::Read( char *buffer, size_t size, int &bytesRead )
Expand Down Expand Up @@ -194,6 +194,7 @@ namespace XrdCl
{
case XrdTls::TLS_AOK: return Status();

case XrdTls::TLS_WantConnect:
case XrdTls::TLS_WantWrite:
case XrdTls::TLS_WantRead: return Status( stOK, suRetry, error );

Expand Down
6 changes: 6 additions & 0 deletions src/XrdTls/XrdTlsSocket.cc
Expand Up @@ -192,6 +192,10 @@ XrdTls::RC XrdTlsSocket::Connect(const char *thehost, XrdNetAddrInfo *netInfo,
int rc = SSL_connect( pImpl->ssl );
if (rc != 1) return Diagnose(rc);

// Set the hsDone flag!
//
pImpl->hsDone = bool( SSL_is_init_finished( pImpl->ssl ) );

// Validate the host name if so desired. Note that cert verification is
// checked by the notary since only hostname validation requires it.

Expand Down Expand Up @@ -455,6 +459,7 @@ XrdTls::RC XrdTlsSocket::Read( char *buffer, size_t size, int &bytesRead )
//
if( rc > 0 )
{bytesRead = rc;
if( !pImpl->hsDone ) pImpl->hsDone = bool( SSL_is_init_finished( pImpl->ssl ) );
return XrdTls::TLS_AOK;
}

Expand Down Expand Up @@ -552,6 +557,7 @@ XrdTls::RC XrdTlsSocket::Write( const char *buffer, size_t size,
//
if( rc > 0 )
{bytesWritten = rc;
if( !pImpl->hsDone ) pImpl->hsDone = bool( SSL_is_init_finished( pImpl->ssl ) );
return XrdTls::TLS_AOK;
}

Expand Down

0 comments on commit 8c0e5b5

Please sign in to comment.