Revert "Modified TLS code to handle disconnects a little cleaner."

This reverts commit c273a4ac5e.
This commit is contained in:
Mike McDonald 2014-01-20 11:08:33 -05:00
parent 3ddf681feb
commit 4e31b9bbb9
2 changed files with 14 additions and 18 deletions

View File

@ -43,7 +43,6 @@ struct rdp_tls
void* tsg;
int sockfd;
SSL_CTX* ctx;
int disconnected;
BYTE* PublicKey;
BIO_METHOD* methods;
DWORD PublicKeyLength;

View File

@ -364,22 +364,7 @@ BOOL tls_disconnect(rdpTls* tls)
return FALSE;
if (tls->ssl)
{
if (tls->disconnected)
{
/**
* In cases where the underlying socket has become disconnected,
* there is no need to send a "close notify" shutdown alert. In
* fact, attempting to do so can cause a crash in SSL_shutdown.
*
* The following code disables sending the "close notify".
*/
SSL_set_quiet_shutdown(tls->ssl, 1);
}
SSL_shutdown(tls->ssl);
}
return TRUE;
}
@ -427,7 +412,6 @@ int tls_read(rdpTls* tls, BYTE* data, int length)
else
{
tls_print_error("SSL_read", tls->ssl, status);
tls->disconnected = 1;
status = -1;
}
break;
@ -439,6 +423,13 @@ int tls_read(rdpTls* tls, BYTE* data, int length)
}
}
/* No need to send "close notify" shutdown alert to peer. In
fact, some circumstances will cause SSL_shutdown to crash. */
if (status == -1)
{
SSL_set_shutdown(tls->ssl, SSL_SENT_SHUTDOWN);
}
return status;
}
@ -479,7 +470,6 @@ int tls_write(rdpTls* tls, BYTE* data, int length)
else
{
tls_print_error("SSL_write", tls->ssl, status);
tls->disconnected = 1;
status = -1;
}
break;
@ -491,6 +481,13 @@ int tls_write(rdpTls* tls, BYTE* data, int length)
}
}
/* No need to send "close notify" shutdown alert to peer. In
fact, some circumstances will cause SSL_shutdown to crash. */
if (status == -1)
{
SSL_set_shutdown(tls->ssl, SSL_SENT_SHUTDOWN);
}
return status;
}