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

Workaround for CONC-469

If no default authentication plugin was specified and the server sends preferred
authentication method in server hello package client now uses servers preferred
authentication method instead of using mysql_native_password. If no default
authentication plugin was specified and the server didn't send an
authenticatoin method client uses the default mysql_native_password plugin.
This commit is contained in:
Georg Richter
2020-05-25 11:50:04 +02:00
parent cdfecebc99
commit 37a4fd1d6d
2 changed files with 47 additions and 16 deletions

View File

@@ -1730,7 +1730,40 @@ static int test_conc443(MYSQL *my __attribute__((unused)))
return OK;
}
static int test_default_auth(MYSQL *my __attribute__((unused)))
{
MYSQL *mysql;
if (!is_mariadb)
return SKIP;
mysql= mysql_init(NULL);
mysql_options(mysql, MYSQL_DEFAULT_AUTH, "mysql_clear_password");
if (!mysql_real_connect(mysql, hostname, username, password, schema, port, socketname, CLIENT_REMEMBER_OPTIONS))
{
diag("Connection failed. Error: %s", mysql_error(mysql));
mysql_close(mysql);
return FAIL;
}
mysql_close(mysql);
mysql= mysql_init(NULL);
mysql_options(mysql, MYSQL_DEFAULT_AUTH, "caching_sha2_password");
if (!mysql_real_connect(mysql, hostname, username, password, schema, port, socketname, CLIENT_REMEMBER_OPTIONS))
{
diag("Connection failed. Error: %s", mysql_error(mysql));
mysql_close(mysql);
return FAIL;
}
mysql_close(mysql);
return OK;
}
struct my_tests_st my_tests[] = {
{"test_default_auth", test_default_auth, TEST_CONNECTION_NONE, 0, NULL, NULL},
{"test_conc443", test_conc443, TEST_CONNECTION_NONE, 0, NULL, NULL},
{"test_conc366", test_conc366, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc392", test_conc392, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},