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

Fixed plugin header and added parsec test

This commit is contained in:
Georg Richter
2024-08-28 18:22:53 +02:00
parent dd8df0c8ec
commit fb0496cd81
2 changed files with 41 additions and 0 deletions

View File

@@ -2336,7 +2336,46 @@ static int test_conc505(MYSQL *my __attribute__((unused)))
return OK;
}
static int test_parsec(MYSQL *my)
{
int rc;
int verify= 0;
MYSQL *mysql;
rc= mysql_query(my, "INSTALL soname 'auth_parsec'");
if (rc)
{
diag("server doesn't support parsec plugin");
return SKIP;
}
rc= mysql_query(my, "CREATE OR REPLACE USER test1@'%' IDENTIFIED VIA parsec using PASSWORD('123')");
check_mysql_rc(rc, my);
mysql= mysql_init(NULL);
if (!mysql_client_find_plugin(mysql, "parsec", MYSQL_CLIENT_AUTHENTICATION_PLUGIN))
{
diag("parsec plugin not available");
diag("error: %s", mysql_error(mysql));
mysql_close(mysql);
return SKIP;
}
mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &verify);
if (!my_test_connect(mysql, hostname, "test1", "123", NULL, port, socketname, 0, 0))
{
diag("Connection failed. Error: %s", mysql_error(mysql));
mysql_close(mysql);
return FAIL;
}
rc= mysql_query(my, "DROP USER test1@'%'");
check_mysql_rc(rc, my);
mysql_close(mysql);
return OK;
}
struct my_tests_st my_tests[] = {
{"test_parsec", test_parsec, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"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},