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-505:

Don't allow to specify unsupported client flags (like
CLIENT_DEPRECATE_EOF) as client flag in mysql_real_connect
api function.
This commit is contained in:
Georg Richter
2024-02-22 09:03:51 +01:00
parent 06d0b9bfe3
commit ebe1949540
5 changed files with 44 additions and 2 deletions

View File

@@ -2307,7 +2307,33 @@ static int test_conc632(MYSQL *my __attribute__((unused)))
return OK;
}
static int test_conc505(MYSQL *my __attribute__((unused)))
{
MYSQL *mysql= mysql_init(NULL);
#define CLIENT_DEPRECATE_EOF (1ULL << 24)
if (my_test_connect(mysql, hostname, username, password, schema, port, socketname, CLIENT_DEPRECATE_EOF))
{
diag("Error expected: Invalid client flag");
mysql_close(mysql);
return FAIL;
}
diag("Error (expected): %s", mysql_error(mysql));
FAIL_IF(mysql_errno(mysql) != CR_INVALID_CLIENT_FLAG, "Wrong error number");
if (!my_test_connect(mysql, hostname, username, password, schema, port, socketname, CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS))
{
diag("Error: %s", mysql_error(mysql));
mysql_close(mysql);
return FAIL;
}
mysql_close(mysql);
return OK;
}
struct my_tests_st my_tests[] = {
{"test_conc505", test_conc505, TEST_CONNECTION_NONE, 0, NULL, NULL},
{"test_conc632", test_conc632, TEST_CONNECTION_NONE, 0, NULL, NULL},
{"test_status_callback", test_status_callback, TEST_CONNECTION_NONE, 0, NULL, NULL},
{"test_conc365", test_conc365, TEST_CONNECTION_NONE, 0, NULL, NULL},