summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2011-01-31 17:32:57 +0200
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2011-01-31 17:32:57 +0200
commit5599fef0767da9349fefb4fbbccff53615f6203a (patch)
tree03be30ece1453ea087f51b252098235fd374114f /plugin
parent565d34539c298120c5d7a72da464158f0cb16049 (diff)
downloadmariadb-git-5599fef0767da9349fefb4fbbccff53615f6203a.tar.gz
Bug #59657: Move the client authentication_pam plugin into the server repository
Created a clear text built in client authentication plugin. Test case added. Added a negative test case : a login failure.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/auth/test_plugin.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/plugin/auth/test_plugin.c b/plugin/auth/test_plugin.c
index 161062d5b6c..d38b2782285 100644
--- a/plugin/auth/test_plugin.c
+++ b/plugin/auth/test_plugin.c
@@ -82,6 +82,36 @@ static struct st_mysql_auth auth_test_handler=
auth_test_plugin
};
+/**
+ dialog test plugin mimicking the ordinary auth mechanism. Used to test the clear text plugin API
+*/
+static int auth_cleartext_plugin(MYSQL_PLUGIN_VIO *vio,
+ MYSQL_SERVER_AUTH_INFO *info)
+{
+ unsigned char *pkt;
+ int pkt_len;
+
+ /* read the password */
+ if ((pkt_len= vio->read_packet(vio, &pkt)) < 0)
+ return CR_ERROR;
+
+ info->password_used= PASSWORD_USED_YES;
+
+ /* fail if the password is wrong */
+ if (strcmp((const char *) pkt, info->auth_string))
+ return CR_ERROR;
+
+ return CR_OK;
+}
+
+
+static struct st_mysql_auth auth_cleartext_handler=
+{
+ MYSQL_AUTHENTICATION_INTERFACE_VERSION,
+ "mysql_clear_password", /* requires the clear text plugin */
+ auth_cleartext_plugin
+};
+
mysql_declare_plugin(test_plugin)
{
MYSQL_AUTHENTICATION_PLUGIN,
@@ -96,9 +126,24 @@ mysql_declare_plugin(test_plugin)
NULL,
NULL,
NULL
+},
+{
+ MYSQL_AUTHENTICATION_PLUGIN,
+ &auth_cleartext_handler,
+ "cleartext_plugin_server",
+ "Georgi Kodinov",
+ "cleartext plugin API test plugin",
+ PLUGIN_LICENSE_GPL,
+ NULL,
+ NULL,
+ 0x0100,
+ NULL,
+ NULL,
+ NULL
}
mysql_declare_plugin_end;
+
/********************* CLIENT SIDE ***************************************/
/*
client plugin used for testing the plugin API