common: avoid possible SSL_shutdown crash

This commit is contained in:
Jay Sorg 2014-12-02 10:52:03 -08:00
parent 290aee8cd9
commit d9d746ce5c
1 changed files with 12 additions and 2 deletions

View File

@ -685,14 +685,24 @@ ssl_tls_accept(struct ssl_tls *self)
}
/*****************************************************************************/
/* returns error, */
int APP_CC
ssl_tls_disconnect(struct ssl_tls *self)
{
int status = SSL_shutdown(self->ssl);
int status;
if (self == NULL)
{
return 0;
}
if (self->ssl == NULL)
{
return 0;
}
status = SSL_shutdown(self->ssl);
while (status != 1)
{
status = SSL_shutdown(self->ssl);
if (status <= 0)
{
if (ssl_tls_print_error("SSL_shutdown", self->ssl, status))