diff --git a/plugins/auth/parsec.c b/plugins/auth/parsec.c index 4fc5445f..cbee05f2 100644 --- a/plugins/auth/parsec.c +++ b/plugins/auth/parsec.c @@ -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", diff --git a/unittest/libmariadb/connection.c b/unittest/libmariadb/connection.c index 3d165f12..e32f7fba 100644 --- a/unittest/libmariadb/connection.c +++ b/unittest/libmariadb/connection.c @@ -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},