diff options
Diffstat (limited to 'vio/viossl.c')
-rw-r--r-- | vio/viossl.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/vio/viossl.c b/vio/viossl.c index 6a479c779cb..ab1f217748d 100644 --- a/vio/viossl.c +++ b/vio/viossl.c @@ -24,6 +24,8 @@ #ifdef HAVE_OPENSSL +#ifndef DBUG_OFF + static void report_errors(SSL* ssl) { @@ -31,9 +33,7 @@ report_errors(SSL* ssl) const char *file; const char *data; int line, flags; -#ifndef DBUG_OFF char buf[512]; -#endif DBUG_ENTER("report_errors"); @@ -56,6 +56,8 @@ report_errors(SSL* ssl) DBUG_VOID_RETURN; } +#endif + size_t vio_ssl_read(Vio *vio, uchar* buf, size_t size) { @@ -149,8 +151,9 @@ void vio_ssl_delete(Vio *vio) static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout, - int (*connect_accept_func)(SSL*), char *error_string) + int (*connect_accept_func)(SSL*), unsigned long *errptr) { + int r; SSL *ssl; my_bool unused; my_bool was_blocking; @@ -166,8 +169,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout, if (!(ssl= SSL_new(ptr->ssl_context))) { DBUG_PRINT("error", ("SSL_new failure")); - report_errors(ssl); - strmov(error_string, "SSL_new failed"); + *errptr= ERR_get_error(); vio_blocking(vio, was_blocking, &unused); DBUG_RETURN(1); } @@ -176,11 +178,10 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout, SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout); SSL_set_fd(ssl, vio->sd); - if (connect_accept_func(ssl) < 1) + if ((r= connect_accept_func(ssl)) < 1) { DBUG_PRINT("error", ("SSL_connect/accept failure")); - report_errors(ssl); - ERR_error_string(SSL_get_error(ssl, 0), error_string); + *errptr= SSL_get_error(ssl, r); SSL_free(ssl); vio_blocking(vio, was_blocking, &unused); DBUG_RETURN(1); @@ -228,19 +229,17 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout, } -int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout, - char *error_string) +int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout, unsigned long *errptr) { DBUG_ENTER("sslaccept"); - DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_accept, error_string)); + DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_accept, errptr)); } -int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout, - char *error_string) +int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout, unsigned long *errptr) { DBUG_ENTER("sslconnect"); - DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_connect, error_string)); + DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_connect, errptr)); } |