summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorArun Kuruvila <arun.kuruvila@oracle.com>2015-10-14 12:00:39 +0530
committerArun Kuruvila <arun.kuruvila@oracle.com>2015-10-14 12:00:39 +0530
commita86191c69c95240ba3dcd9858341a30898c34285 (patch)
tree2d6e78068aa228a2d69ac2bb945265793de267d8 /client
parent3846b085521bce8e4600d4860dc3f2ea5f2ceb2d (diff)
downloadmariadb-git-a86191c69c95240ba3dcd9858341a30898c34285.tar.gz
Bug #21235226 : THE --ENABLE-CLEARTEXT-PLUGIN IS NOT
IMPLEMENTED IN ALL CLIENT PROGRAMS Description: Option "enable-cleartext-plugin" is not available for the following client utilities:- mysqldump mysqlimport mysqlshow mysqlcheck Analysis: The unavailability of this option limits the features like PAM authentication from using the above mentioned utilities. Fix: Option "enable-cleartext-plugin" is implemented in the above mentioned client utilities.
Diffstat (limited to 'client')
-rw-r--r--client/mysqlcheck.c15
-rw-r--r--client/mysqldump.c15
-rw-r--r--client/mysqlimport.c13
-rw-r--r--client/mysqlshow.c15
4 files changed, 55 insertions, 3 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index ca06a85bec0..0d5570434e4 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -42,6 +42,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
opt_write_binlog= 1;
static uint verbose = 0, opt_mysql_port=0;
+static uint opt_enable_cleartext_plugin= 0;
+static my_bool using_opt_enable_cleartext_plugin= 0;
static int my_end_arg;
static char * opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0,
@@ -110,6 +112,10 @@ static struct my_option my_long_options[] =
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"enable_cleartext_plugin", OPT_ENABLE_CLEARTEXT_PLUGIN,
+ "Enable/disable the clear text authentication plugin.",
+ &opt_enable_cleartext_plugin, &opt_enable_cleartext_plugin,
+ 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"fast",'F', "Check only tables that haven't been closed properly.",
&opt_fast, &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
@@ -326,6 +332,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
verbose++;
break;
case 'V': print_version(); exit(0);
+ case OPT_ENABLE_CLEARTEXT_PLUGIN:
+ using_opt_enable_cleartext_plugin= TRUE;
+ break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
@@ -880,6 +889,10 @@ static int dbConnect(char *host, char *user, char *passwd)
if (opt_default_auth && *opt_default_auth)
mysql_options(&mysql_connection, MYSQL_DEFAULT_AUTH, opt_default_auth);
+ if (using_opt_enable_cleartext_plugin)
+ mysql_options(&mysql_connection, MYSQL_ENABLE_CLEARTEXT_PLUGIN,
+ (char *) &opt_enable_cleartext_plugin);
+
mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd,
NULL, opt_mysql_port, opt_mysql_unix_port, 0)))
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 2a873903d60..6bb249134e8 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -129,6 +129,8 @@ static ulong opt_compatible_mode= 0;
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
#define MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL 2
+static uint opt_enable_cleartext_plugin= 0;
+static my_bool using_opt_enable_cleartext_plugin= 0;
static uint opt_mysql_port= 0, opt_master_data;
static uint opt_slave_data;
static uint my_end_arg;
@@ -513,6 +515,10 @@ static struct my_option my_long_options[] =
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"enable_cleartext_plugin", OPT_ENABLE_CLEARTEXT_PLUGIN,
+ "Enable/disable the clear text authentication plugin.",
+ &opt_enable_cleartext_plugin, &opt_enable_cleartext_plugin,
+ 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -883,6 +889,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
break;
}
+ case (int) OPT_ENABLE_CLEARTEXT_PLUGIN:
+ using_opt_enable_cleartext_plugin= TRUE;
+ break;
case (int) OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
@@ -1485,6 +1494,10 @@ static int connect_to_db(char *host, char *user,char *passwd)
if (opt_default_auth && *opt_default_auth)
mysql_options(&mysql_connection, MYSQL_DEFAULT_AUTH, opt_default_auth);
+ if (using_opt_enable_cleartext_plugin)
+ mysql_options(&mysql_connection, MYSQL_ENABLE_CLEARTEXT_PLUGIN,
+ (char *) &opt_enable_cleartext_plugin);
+
if (!(mysql= mysql_real_connect(&mysql_connection,host,user,passwd,
NULL,opt_mysql_port,opt_mysql_unix_port,
0)))
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 813c1baf793..f71111f7e9e 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -49,6 +49,8 @@ static char *opt_password=0, *current_user=0,
*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
*escaped=0, *opt_columns=0,
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
+static uint opt_enable_cleartext_plugin= 0;
+static my_bool using_opt_enable_cleartext_plugin= 0;
static uint opt_mysql_port= 0, opt_protocol= 0;
static char * opt_mysql_unix_port=0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
@@ -88,6 +90,10 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delete", 'd', "First delete all rows from table.", &opt_delete,
&opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"enable_cleartext_plugin", OPT_ENABLE_CLEARTEXT_PLUGIN,
+ "Enable/disable the clear text authentication plugin.",
+ &opt_enable_cleartext_plugin, &opt_enable_cleartext_plugin,
+ 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
"Fields in the input file are terminated by the given string.",
&fields_terminated, &fields_terminated, 0,
@@ -234,6 +240,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_local_file=1;
break;
#endif
+ case OPT_ENABLE_CLEARTEXT_PLUGIN:
+ using_opt_enable_cleartext_plugin= TRUE;
+ break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
@@ -435,6 +444,10 @@ static MYSQL *db_connect(char *host, char *database,
if (opt_default_auth && *opt_default_auth)
mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
+ if (using_opt_enable_cleartext_plugin)
+ mysql_options(mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN,
+ (char*)&opt_enable_cleartext_plugin);
+
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(mysql_real_connect(mysql,host,user,passwd,
database,opt_mysql_port,opt_mysql_unix_port,
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 5677681541b..a6705548bcb 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,6 +37,8 @@ static uint my_end_arg= 0;
static uint opt_verbose=0;
static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
+static uint opt_enable_cleartext_plugin= 0;
+static my_bool using_opt_enable_cleartext_plugin= 0;
#ifdef HAVE_SMEM
static char *shared_memory_base_name=0;
@@ -133,6 +135,10 @@ int main(int argc, char **argv)
if (opt_default_auth && *opt_default_auth)
mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
+ if (using_opt_enable_cleartext_plugin)
+ mysql_options(&mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN,
+ (char*)&opt_enable_cleartext_plugin);
+
if (!(mysql_real_connect(&mysql,host,user,opt_password,
(first_argument_uses_wildcards) ? "" :
argv[0],opt_mysql_port,opt_mysql_unix_port,
@@ -195,6 +201,10 @@ static struct my_option my_long_options[] =
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"enable_cleartext_plugin", OPT_ENABLE_CLEARTEXT_PLUGIN,
+ "Enable/disable the clear text authentication plugin.",
+ &opt_enable_cleartext_plugin, &opt_enable_cleartext_plugin,
+ 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
@@ -309,6 +319,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_protocol = MYSQL_PROTOCOL_PIPE;
#endif
break;
+ case (int) OPT_ENABLE_CLEARTEXT_PLUGIN:
+ using_opt_enable_cleartext_plugin= TRUE;
+ break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);