1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Fix for CONC-276: client library crashes on Windows after TLS reconnect:

The connection pointer mysql is now no longer part (and doesn't need to be updated) of schannel security context, since it can be obtained directly from tls container.
This commit is contained in:
Georg Richter
2017-08-24 18:05:58 +02:00
parent 11321f16bf
commit 02f57a9c14
4 changed files with 47 additions and 20 deletions

View File

@@ -1248,8 +1248,37 @@ if (!(fp= fopen("./mdev13100.cnf", "w")))
return OK;
}
static int test_conc276(MYSQL *unused __attribute__((unused)))
{
MYSQL *mysql= mysql_init(NULL);
int rc;
my_bool val= 1;
mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &val);
mysql_options(mysql, MYSQL_OPT_RECONNECT, &val);
if (!mysql_real_connect(mysql, hostname, username, password, schema, port, socketname, 0))
{
diag("Connection failed. Error: %s", mysql_error(mysql));
mysql_close(mysql);
return FAIL;
}
diag("Cipher in use: %s", mysql_get_ssl_cipher(mysql));
rc= mariadb_reconnect(mysql);
check_mysql_rc(rc, mysql);
diag("Cipher in use: %s", mysql_get_ssl_cipher(mysql));
/* this shouldn't crash anymore */
rc= mysql_query(mysql, "SET @a:=1");
check_mysql_rc(rc, mysql);
mysql_close(mysql);
return OK;
}
struct my_tests_st my_tests[] = {
{"test_conc276", test_conc276, TEST_CONNECTION_NONE, 0, NULL, NULL},
{"test_mdev13100", test_mdev13100, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_auth256", test_auth256, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_reset", test_reset, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},