summaryrefslogtreecommitdiff
path: root/vio/viossl.c
diff options
context:
space:
mode:
authorunknown <msvensson@shellback.(none)>2007-01-26 11:30:54 +0100
committerunknown <msvensson@shellback.(none)>2007-01-26 11:30:54 +0100
commit82fd1703387dd2ca3fcff18938f9024bc9cee24a (patch)
tree7eab9ac618ca44b112fcbcc3ff5fb92e0101be7b /vio/viossl.c
parent7d4477f866d26b8bd8e941e6484d843cc30c83c8 (diff)
downloadmariadb-git-82fd1703387dd2ca3fcff18938f9024bc9cee24a.tar.gz
Bug#25203 Mysql crashes when mysql_kill() is executed in a connection using SSL
- It's too early to free the SSL object in 'vio_ssl_close'. There might still be a thread using or reading from it on platforms where we need to close the active connection/socket in order to break the read. - Add new function 'vio_ssl_delete' and install it as the viodelete function for SSL connections. vio/vio.c: Install 'vio_ssl_delete' as viodelete function for SSL connections Cleanup 'vio_delete' vio/vio_priv.h: Add declaration of vio_ssl_delete vio/viossl.c: Add new function 'vio_ssl_delete' that takes care of freeing the memory allocated by the SSL connection Move the code to free the SSL object from vio_ssl_close
Diffstat (limited to 'vio/viossl.c')
-rw-r--r--vio/viossl.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/vio/viossl.c b/vio/viossl.c
index 4267486112f..5e4203a3fb5 100644
--- a/vio/viossl.c
+++ b/vio/viossl.c
@@ -140,13 +140,29 @@ int vio_ssl_close(Vio *vio)
SSL_get_error(ssl, r)));
break;
}
- SSL_free(ssl);
- vio->ssl_arg= 0;
}
DBUG_RETURN(vio_close(vio));
}
+void vio_ssl_delete(Vio *vio)
+{
+ if (!vio)
+ return; /* It must be safe to delete null pointer */
+
+ if (vio->type == VIO_TYPE_SSL)
+ vio_ssl_close(vio); /* Still open, close connection first */
+
+ if (vio->ssl_arg)
+ {
+ SSL_free((SSL*) vio->ssl_arg);
+ vio->ssl_arg= 0;
+ }
+
+ vio_delete(vio);
+}
+
+
int sslaccept(struct st_VioSSLFd *ptr, Vio *vio, long timeout)
{
SSL *ssl;