You've already forked mariadb-connector-c
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:
@@ -203,6 +203,8 @@ struct st_mysql_client_plugin_AUTHENTICATION parsec_client_plugin=
|
||||
struct st_mysql_client_plugin_AUTHENTICATION _mysql_client_plugin_declaration_ =
|
||||
#endif
|
||||
{
|
||||
.type = MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
|
||||
.interface_version = MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION,
|
||||
.name = "parsec",
|
||||
.author = "Nikita Maliavin",
|
||||
.desc = "Password Authentication using Response Signed with Elliptic Curve",
|
||||
|
@@ -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},
|
||||
|
Reference in New Issue
Block a user