summaryrefslogtreecommitdiff
path: root/sql-common
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 /sql-common
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 'sql-common')
-rw-r--r--sql-common/client.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 3b7fc11a537..0ff03f6609b 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2261,6 +2261,7 @@ typedef struct st_mysql_client_plugin_AUTHENTICATION auth_plugin_t;
static int client_mpvio_write_packet(struct st_plugin_vio*, const uchar*, int);
static int native_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
+static int clear_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql);
static auth_plugin_t native_password_client_plugin=
{
@@ -2294,10 +2295,27 @@ static auth_plugin_t old_password_client_plugin=
old_password_auth_client
};
+static auth_plugin_t clear_password_client_plugin=
+{
+ MYSQL_CLIENT_AUTHENTICATION_PLUGIN,
+ MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION,
+ "mysql_clear_password",
+ "Georgi Kodinov",
+ "Clear password authentication plugin",
+ {0,1,0},
+ "GPL",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ clear_password_auth_client
+};
+
struct st_mysql_client_plugin *mysql_client_builtins[]=
{
(struct st_mysql_client_plugin *)&native_password_client_plugin,
(struct st_mysql_client_plugin *)&old_password_client_plugin,
+ (struct st_mysql_client_plugin *)&clear_password_client_plugin,
0
};
@@ -4271,3 +4289,20 @@ static int old_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
DBUG_RETURN(CR_OK);
}
+
+/**
+ The main function of the mysql_clear_password authentication plugin.
+*/
+
+static int clear_password_auth_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
+{
+ int res;
+
+ /* send password in clear text */
+ res= vio->write_packet(vio, (const unsigned char *) mysql->passwd,
+ strlen(mysql->passwd) + 1);
+
+ return res ? CR_ERROR : CR_OK;
+}
+
+