Approved by: steve@openssl.org

Handle non-blocking I/O properly in SSL_shutdown() call.
This commit is contained in:
Dr. Stephen Henson
2009-04-07 16:28:30 +00:00
parent 3fdc2c906d
commit 0d399f97dd
4 changed files with 24 additions and 5 deletions

View File

@@ -1268,13 +1268,13 @@ int ssl3_do_change_cipher_spec(SSL *s)
return(1);
}
void ssl3_send_alert(SSL *s, int level, int desc)
int ssl3_send_alert(SSL *s, int level, int desc)
{
/* Map tls/ssl alert value to correct one */
desc=s->method->ssl3_enc->alert_value(desc);
if (s->version == SSL3_VERSION && desc == SSL_AD_PROTOCOL_VERSION)
desc = SSL_AD_HANDSHAKE_FAILURE; /* SSL 3.0 does not have protocol_version alerts */
if (desc < 0) return;
if (desc < 0) return -1;
/* If a fatal one, remove from cache */
if ((level == 2) && (s->session != NULL))
SSL_CTX_remove_session(s->ctx,s->session);
@@ -1283,9 +1283,10 @@ void ssl3_send_alert(SSL *s, int level, int desc)
s->s3->send_alert[0]=level;
s->s3->send_alert[1]=desc;
if (s->s3->wbuf.left == 0) /* data still being written out? */
s->method->ssl_dispatch_alert(s);
return s->method->ssl_dispatch_alert(s);
/* else data is still being written out, we will get written
* some time in the future */
return -1;
}
int ssl3_dispatch_alert(SSL *s)