diff --git a/deps/mariadb-client-library/UPGRADE_NOTES.md b/deps/mariadb-client-library/UPGRADE_NOTES.md new file mode 100644 index 000000000..32e1a7f0c --- /dev/null +++ b/deps/mariadb-client-library/UPGRADE_NOTES.md @@ -0,0 +1,4 @@ +Please note that upgrading `mariadb-connector-c` can require some changes +in `include/MySQL_Data_Stream.h` where we define `P_MARIADB_TLS` as a copy +of `MARIADB_TLS` . If `MARIADB_TLS` is changed, `P_MARIADB_TLS` must be +updated too. diff --git a/deps/mariadb-client-library/mariadb-connector-c-2.3.1-src.tar.gz b/deps/mariadb-client-library/mariadb-connector-c-2.3.1-src.tar.gz deleted file mode 100644 index 5d68f7402..000000000 Binary files a/deps/mariadb-client-library/mariadb-connector-c-2.3.1-src.tar.gz and /dev/null differ diff --git a/deps/mariadb-client-library/mariadb-connector-c-3.0.2-src.tar.gz b/deps/mariadb-client-library/mariadb-connector-c-3.0.2-src.tar.gz deleted file mode 100644 index de98af6d2..000000000 Binary files a/deps/mariadb-client-library/mariadb-connector-c-3.0.2-src.tar.gz and /dev/null differ diff --git a/deps/mariadb-client-library/mariadb-connector-c-3.0.9-src.tar.gz b/deps/mariadb-client-library/mariadb-connector-c-3.0.9-src.tar.gz deleted file mode 100644 index d832031c9..000000000 Binary files a/deps/mariadb-client-library/mariadb-connector-c-3.0.9-src.tar.gz and /dev/null differ diff --git a/deps/mariadb-client-library/mariadb-connector-c-3.1.4-src.tar.gz b/deps/mariadb-client-library/mariadb-connector-c-3.1.4-src.tar.gz deleted file mode 100644 index e24be31d1..000000000 Binary files a/deps/mariadb-client-library/mariadb-connector-c-3.1.4-src.tar.gz and /dev/null differ diff --git a/include/MySQL_Data_Stream.h b/include/MySQL_Data_Stream.h index 0c71582b2..19627975d 100644 --- a/include/MySQL_Data_Stream.h +++ b/include/MySQL_Data_Stream.h @@ -6,6 +6,21 @@ #include "MySQL_Protocol.h" +#ifndef uchar +typedef unsigned char uchar; +#endif + +#include "ma_pvio.h" +// here we define P_MARIADB_TLS as a copy of MARIADB_TLS +// copied from ma_tls.h +// note that ma_pvio.h defines it as void +typedef struct P_st_ma_pvio_tls { + void *data; + MARIADB_PVIO *pvio; + void *ssl; +} P_MARIADB_TLS; + + #define QUEUE_T_DEFAULT_SIZE 32768 #define MY_SSL_BUFFER 8192 @@ -192,6 +207,26 @@ class MySQL_Data_Stream myconn=mc; myconn->statuses.myconnpoll_get++; mc->myds=this; + // we handle encryption for backend + // + // we have a similar code in MySQL_Connection + // in case of ASYNC_CONNECT_SUCCESSFUL + encrypted = false; + if (sess != NULL && sess->session_fast_forward == true) { + if (myconn->mysql && myconn->ret_mysql) { + if (myconn->mysql->options.use_ssl == 1) { + encrypted = true; + if (ssl == NULL) { + // check the definition of P_MARIADB_TLS + P_MARIADB_TLS * matls = (P_MARIADB_TLS *)myconn->mysql->net.pvio->ctls; + ssl = (SSL *)matls->ssl; + rbio_ssl = BIO_new(BIO_s_mem()); + wbio_ssl = BIO_new(BIO_s_mem()); + SSL_set_bio(ssl, rbio_ssl, wbio_ssl); + } + } + } + } } // safe way to detach a MySQL Connection diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index a02e274be..c51df2fdd 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -22,6 +22,7 @@ void ma_free_root(MA_MEM_ROOT *root, myf MyFLAGS); void *ma_alloc_root(MA_MEM_ROOT *mem_root, size_t Size); #define MAX(a,b) (((a) > (b)) ? (a) : (b)) + void * ma_alloc_root(MA_MEM_ROOT *mem_root, size_t Size) { size_t get_size; @@ -1113,6 +1114,26 @@ handler_again: } break; case ASYNC_CONNECT_SUCCESSFUL: + if (mysql && ret_mysql) { + // we handle encryption for backend + // + // we have a similar code in MySQL_Data_Stream::attach_connection() + if (mysql->options.use_ssl == 1) + if (myds) + if (myds->sess != NULL) + if (myds->sess->session_fast_forward == true) { + myds->encrypted = true; + assert(myds->ssl==NULL); + if (myds->ssl == NULL) { + // check the definition of P_MARIADB_TLS + P_MARIADB_TLS * matls = (P_MARIADB_TLS *)mysql->net.pvio->ctls; + myds->ssl = (SSL *)matls->ssl; + myds->rbio_ssl = BIO_new(BIO_s_mem()); + myds->wbio_ssl = BIO_new(BIO_s_mem()); + SSL_set_bio(myds->ssl, myds->rbio_ssl, myds->wbio_ssl); + } + } + } __sync_fetch_and_add(&MyHGM->status.server_connections_connected,1); __sync_fetch_and_add(&parent->connect_OK,1); options.client_flag = mysql->client_flag;