summaryrefslogtreecommitdiff
path: root/vio/viossl.c
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-11-25 18:17:28 +0100
committerSergei Golubchik <sergii@pisem.net>2010-11-25 18:17:28 +0100
commit65ca700def99289cc31a7040537f5aa6e12bf485 (patch)
tree97b3a07299b626c519da0e80c122b5b79b933914 /vio/viossl.c
parent2ab57de38d13d927ddff2d51aed4af34e13998f5 (diff)
parent6e5bcca7935d3c62f84bb640e5357664a210ee12 (diff)
downloadmariadb-git-65ca700def99289cc31a7040537f5aa6e12bf485.tar.gz
merge.
checkpoint. does not compile.
Diffstat (limited to 'vio/viossl.c')
-rw-r--r--vio/viossl.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/vio/viossl.c b/vio/viossl.c
index 5cb5f36f20d..6a479c779cb 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -44,8 +44,13 @@ report_errors(SSL* ssl)
}
if (ssl)
- DBUG_PRINT("error", ("error: %s",
- ERR_error_string(SSL_get_error(ssl, l), buf)));
+ {
+#ifndef DBUG_OFF
+ int error= SSL_get_error(ssl, l);
+ DBUG_PRINT("error", ("error: %s (%d)",
+ ERR_error_string(error, buf), error));
+#endif
+ }
DBUG_PRINT("info", ("socket_errno: %d", socket_errno));
DBUG_VOID_RETURN;
@@ -144,16 +149,17 @@ void vio_ssl_delete(Vio *vio)
static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
- int (*connect_accept_func)(SSL*))
+ int (*connect_accept_func)(SSL*), char *error_string)
{
SSL *ssl;
my_bool unused;
my_bool was_blocking;
-
DBUG_ENTER("ssl_do");
DBUG_PRINT("enter", ("ptr: 0x%lx, sd: %d ctx: 0x%lx",
(long) ptr, vio->sd, (long) ptr->ssl_context));
+ error_string[0]= 0;
+
/* Set socket to blocking if not already set */
vio_blocking(vio, 1, &was_blocking);
@@ -161,6 +167,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
{
DBUG_PRINT("error", ("SSL_new failure"));
report_errors(ssl);
+ strmov(error_string, "SSL_new failed");
vio_blocking(vio, was_blocking, &unused);
DBUG_RETURN(1);
}
@@ -173,6 +180,7 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
{
DBUG_PRINT("error", ("SSL_connect/accept failure"));
report_errors(ssl);
+ ERR_error_string(SSL_get_error(ssl, 0), error_string);
SSL_free(ssl);
vio_blocking(vio, was_blocking, &unused);
DBUG_RETURN(1);
@@ -220,17 +228,19 @@ static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
}
-int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
+int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ char *error_string)
{
DBUG_ENTER("sslaccept");
- DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_accept));
+ DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_accept, error_string));
}
-int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
+int sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
+ char *error_string)
{
DBUG_ENTER("sslconnect");
- DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_connect));
+ DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_connect, error_string));
}