summaryrefslogtreecommitdiff
path: root/vio/viossl.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
committerSergei Golubchik <sergii@pisem.net>2011-07-02 22:08:51 +0200
commit9809f05199aeb0b67991fac41bd86f38730768dc (patch)
treefa2792ff86d0da014b535d743759810612338042 /vio/viossl.c
parent0accbd0364e0333e0b119aa9ce93e34ded9df6cb (diff)
parent5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a (diff)
downloadmariadb-git-9809f05199aeb0b67991fac41bd86f38730768dc.tar.gz
5.5-merge
Diffstat (limited to 'vio/viossl.c')
-rw-r--r--vio/viossl.c27
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));
}