Below is the list of changes that have just been committed into a local
5.0 repository of msvensson. When msvensson does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-01-26 11:30:54+01:00, msvensson@shellback.(none) +3 -0
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@stripped, 2007-01-26 11:30:51+01:00, msvensson@shellback.(none) +9 -10
Install 'vio_ssl_delete' as viodelete function for SSL connections
Cleanup 'vio_delete'
vio/vio_priv.h@stripped, 2007-01-26 11:30:51+01:00, msvensson@shellback.(none) +1 -0
Add declaration of vio_ssl_delete
vio/viossl.c@stripped, 2007-01-26 11:30:51+01:00, msvensson@shellback.(none) +18 -2
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
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: msvensson
# Host: shellback.(none)
# Root: /home/msvensson/mysql/bug25203/my50-bug25203
--- 1.7/vio/vio_priv.h 2007-01-26 11:31:01 +01:00
+++ 1.8/vio/vio_priv.h 2007-01-26 11:31:01 +01:00
@@ -32,6 +32,7 @@
/* When the workday is over... */
int vio_ssl_close(Vio *vio);
+void vio_ssl_delete(Vio *vio);
int vio_ssl_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode);
--- 1.29/vio/vio.c 2007-01-26 11:31:01 +01:00
+++ 1.30/vio/vio.c 2007-01-26 11:31:01 +01:00
@@ -86,7 +86,7 @@
#ifdef HAVE_OPENSSL
if (type == VIO_TYPE_SSL)
{
- vio->viodelete =vio_delete;
+ vio->viodelete =vio_ssl_delete;
vio->vioerrno =vio_errno;
vio->read =vio_ssl_read;
vio->write =vio_ssl_write;
@@ -220,17 +220,16 @@
#endif
#endif
+
void vio_delete(Vio* vio)
{
- /* It must be safe to delete null pointers. */
- /* This matches the semantics of C++'s delete operator. */
- if (vio)
- {
- if (vio->type != VIO_CLOSED)
- vio->vioclose(vio);
- my_free((gptr) vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR));
- my_free((gptr) vio,MYF(0));
- }
+ if (!vio)
+ return; /* It must be safe to delete null pointers. */
+
+ if (vio->type != VIO_CLOSED)
+ vio->vioclose(vio);
+ my_free((gptr) vio->read_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((gptr) vio,MYF(0));
}
--- 1.40/vio/viossl.c 2007-01-26 11:31:01 +01:00
+++ 1.41/vio/viossl.c 2007-01-26 11:31:01 +01:00
@@ -140,10 +140,26 @@
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);
}
| Thread |
|---|
| • bk commit into 5.0 tree (msvensson:1.2392) BUG#25203 | msvensson | 26 Jan |