mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-09 03:15:40 +00:00
Add ssl_close_notify() to servers that missed it
This commit is contained in:
parent
875548ce67
commit
3cbaf1e379
|
@ -42,6 +42,7 @@ Bugfix
|
|||
* ssl_handshake_init() was leaving dirty pointers in subcontexts if malloc
|
||||
of one of them failed
|
||||
* x509_get_current_time() uses localtime_r() to prevent thread issues
|
||||
* Some example server programs were not sending the close_notify alert.
|
||||
|
||||
= Version 1.2.10 released 2013-10-07
|
||||
Changes
|
||||
|
|
|
@ -616,6 +616,7 @@ int main( int argc, char *argv[] )
|
|||
if( ret == 0 )
|
||||
{
|
||||
printf("\n\nEOF\n\n");
|
||||
ssl_close_notify( &ssl );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -624,9 +625,9 @@ int main( int argc, char *argv[] )
|
|||
}
|
||||
while( 1 );
|
||||
|
||||
ssl_close_notify( &ssl );
|
||||
|
||||
exit:
|
||||
if( ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY )
|
||||
ret = 0;
|
||||
|
||||
#ifdef POLARSSL_ERROR_C
|
||||
if( ret != 0 )
|
||||
|
|
|
@ -324,7 +324,21 @@ reset:
|
|||
|
||||
len = ret;
|
||||
printf( " %d bytes written\n\n%s\n", len, (char *) buf );
|
||||
|
||||
|
||||
printf( " . Closing the connection..." );
|
||||
|
||||
while( ( ret = ssl_close_notify( &ssl ) ) < 0 )
|
||||
{
|
||||
if( ret != POLARSSL_ERR_NET_WANT_READ &&
|
||||
ret != POLARSSL_ERR_NET_WANT_WRITE )
|
||||
{
|
||||
printf( " failed\n ! ssl_close_notify returned %d\n\n", ret );
|
||||
goto reset;
|
||||
}
|
||||
}
|
||||
|
||||
printf( " ok\n" );
|
||||
|
||||
ret = 0;
|
||||
goto reset;
|
||||
|
||||
|
|
|
@ -684,6 +684,20 @@ reset:
|
|||
len = ret;
|
||||
printf( " %d bytes written\n\n%s\n", len, (char *) buf );
|
||||
|
||||
printf( " . Closing the connection..." );
|
||||
|
||||
while( ( ret = ssl_close_notify( &ssl ) ) < 0 )
|
||||
{
|
||||
if( ret != POLARSSL_ERR_NET_WANT_READ &&
|
||||
ret != POLARSSL_ERR_NET_WANT_WRITE )
|
||||
{
|
||||
printf( " failed\n ! ssl_close_notify returned %d\n\n", ret );
|
||||
goto reset;
|
||||
}
|
||||
}
|
||||
|
||||
printf( " ok\n" );
|
||||
|
||||
ret = 0;
|
||||
goto reset;
|
||||
|
||||
|
|
Loading…
Reference in a new issue