Commit 25f433bd authored by Nirbhay Choubey's avatar Nirbhay Choubey

Bug#58139 : default-auth option not recognized in MySQL standard

            command line clients.

Postfix covering other mysql standard clients like mysql_upgrade,
mysqlbinlog, mysqlcheck, mysqlimport, mysqlshow and mysqlslap.


client/client_priv.h:
  Bug#58139 : default-auth option not recognized in MySQL standard
              command line clients
  
  Added an entry for 'default-auth' option.
client/mysql.cc:
  Bug#58139 : default-auth option not recognized in MySQL standard
              command line clients
  
  Updated the id entry for default_auth option.
client/mysql_upgrade.c:
  Bug#58139 : default-auth option not recognized in MySQL standard
              command line clients.
  
  Introduced two new variables to hold values from default-auth and
  plugin-dir options and further pushed them to client's st_mysql
  instance.
client/mysqladmin.cc:
  Bug#58139 : default-auth option not recognized in MySQL standard
              command line clients
  
  Updated the id entry for default_auth option.
client/mysqlbinlog.cc:
  Bug#58139 : default-auth option not recognized in MySQL standard
              command line clients.
  
  Introduced two new variables to hold values from default-auth and
  plugin-dir options and further pushed them to client's st_mysql
  instance.
client/mysqlcheck.c:
  Bug#58139 : default-auth option not recognized in MySQL standard
              command line clients.
  
  Introduced two new variables to hold values from default-auth and
  plugin-dir options and further pushed them to client's st_mysql
  instance.
client/mysqldump.c:
  Bug#58139 : default-auth option not recognized in MySQL standard
              command line clients
  
  Updated the id entry for default_auth option.
client/mysqlimport.c:
  Bug#58139 : default-auth option not recognized in MySQL standard
              command line clients.
  
  Introduced two new variables to hold values from default-auth and
  plugin-dir options and further pushed them to client's st_mysql
  instance.
client/mysqlshow.c:
  Bug#58139 : default-auth option not recognized in MySQL standard
              command line clients.
  
  Introduced two new variables to hold values from default-auth and
  plugin-dir options and further pushed them to client's st_mysql
  instance.
client/mysqlslap.c:
  Bug#58139 : default-auth option not recognized in MySQL standard
              command line clients.
  
  Introduced two new variables to hold values from default-auth and
  plugin-dir options and further pushed them to client's st_mysql
  instance.
mysql-test/r/plugin_auth.result:
  Added test case for Bug#58139 for mysql_upgrade.
mysql-test/t/plugin_auth.test:
  Added test case for Bug#58139 for mysql_upgrade.
parent 146255f7
...@@ -85,6 +85,7 @@ enum options_client ...@@ -85,6 +85,7 @@ enum options_client
OPT_WRITE_BINLOG, OPT_DUMP_DATE, OPT_WRITE_BINLOG, OPT_DUMP_DATE,
OPT_INIT_COMMAND, OPT_INIT_COMMAND,
OPT_PLUGIN_DIR, OPT_PLUGIN_DIR,
OPT_DEFAULT_AUTH,
OPT_DEFAULT_PLUGIN, OPT_DEFAULT_PLUGIN,
OPT_MAX_CLIENT_OPTION OPT_MAX_CLIENT_OPTION
}; };
......
...@@ -162,7 +162,7 @@ static int wait_time = 5; ...@@ -162,7 +162,7 @@ static int wait_time = 5;
static STATUS status; static STATUS status;
static ulong select_limit,max_join_size,opt_connect_timeout=0; static ulong select_limit,max_join_size,opt_connect_timeout=0;
static char mysql_charsets_dir[FN_REFLEN+1]; static char mysql_charsets_dir[FN_REFLEN+1];
static char *opt_plugin_dir= 0, *opt_default_auth; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static const char *xmlmeta[] = { static const char *xmlmeta[] = {
"&", "&", "&", "&",
"<", "&lt;", "<", "&lt;",
...@@ -1564,7 +1564,7 @@ static struct my_option my_long_options[] = ...@@ -1564,7 +1564,7 @@ static struct my_option my_long_options[] =
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_PLUGIN_DIR, {"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.", "Default authentication client-side plugin to use.",
(uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
......
...@@ -45,6 +45,8 @@ static DYNAMIC_STRING ds_args; ...@@ -45,6 +45,8 @@ static DYNAMIC_STRING ds_args;
static DYNAMIC_STRING conn_args; static DYNAMIC_STRING conn_args;
static char *opt_password= 0; static char *opt_password= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static my_bool tty_password= 0; static my_bool tty_password= 0;
static char opt_tmpdir[FN_REFLEN] = ""; static char opt_tmpdir[FN_REFLEN] = "";
...@@ -88,6 +90,10 @@ static struct my_option my_long_options[]= ...@@ -88,6 +90,10 @@ static struct my_option my_long_options[]=
{"default-character-set", OPT_DEFAULT_CHARSET, {"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", 0, "Set the default character set.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
(uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade " {"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade "
"has already been executed for the current version of MySQL.", "has already been executed for the current version of MySQL.",
&opt_force, &opt_force, 0, &opt_force, &opt_force, 0,
...@@ -102,6 +108,9 @@ static struct my_option my_long_options[]= ...@@ -102,6 +108,9 @@ static struct my_option my_long_options[]=
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in " {"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, " "order of preference, my.cnf, $MYSQL_TCP_PORT, "
#if MYSQL_PORT_DEFAULT == 0 #if MYSQL_PORT_DEFAULT == 0
...@@ -283,6 +292,8 @@ get_one_option(int optid, const struct my_option *opt, ...@@ -283,6 +292,8 @@ get_one_option(int optid, const struct my_option *opt,
case 'S': /* --socket */ case 'S': /* --socket */
case OPT_MYSQL_PROTOCOL: /* --protocol */ case OPT_MYSQL_PROTOCOL: /* --protocol */
case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */ case OPT_SHARED_MEMORY_BASE_NAME: /* --shared-memory-base-name */
case OPT_PLUGIN_DIR: /* --plugin-dir */
case OPT_DEFAULT_AUTH: /* --default-auth */
add_one_option(&conn_args, opt, argument); add_one_option(&conn_args, opt, argument);
break; break;
} }
......
...@@ -42,7 +42,7 @@ static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations; ...@@ -42,7 +42,7 @@ static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations;
static uint opt_count_iterations= 0, my_end_arg; static uint opt_count_iterations= 0, my_end_arg;
static ulong opt_connect_timeout, opt_shutdown_timeout; static ulong opt_connect_timeout, opt_shutdown_timeout;
static char * unix_port=0; static char * unix_port=0;
static char *opt_plugin_dir= 0, *opt_default_auth; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
static char *shared_memory_base_name=0; static char *shared_memory_base_name=0;
...@@ -208,7 +208,7 @@ static struct my_option my_long_options[] = ...@@ -208,7 +208,7 @@ static struct my_option my_long_options[] =
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_PLUGIN_DIR, {"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.", "Default authentication client-side plugin to use.",
(uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
......
...@@ -79,6 +79,8 @@ static char* host = 0; ...@@ -79,6 +79,8 @@ static char* host = 0;
static int port= 0; static int port= 0;
static uint my_end_arg; static uint my_end_arg;
static const char* sock= 0; static const char* sock= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
static char *shared_memory_base_name= 0; static char *shared_memory_base_name= 0;
#endif #endif
...@@ -1039,6 +1041,10 @@ static struct my_option my_long_options[] = ...@@ -1039,6 +1041,10 @@ static struct my_option my_long_options[] =
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
&debug_info_flag, &debug_info_flag, &debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
(uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"disable-log-bin", 'D', "Disable binary log. This is useful, if you " {"disable-log-bin", 'D', "Disable binary log. This is useful, if you "
"enabled --to-last-log and are sending the output to the same MySQL server. " "enabled --to-last-log and are sending the output to the same MySQL server. "
"This way you could avoid an endless loop. You would also like to use it " "This way you could avoid an endless loop. You would also like to use it "
...@@ -1064,6 +1070,9 @@ static struct my_option my_long_options[] = ...@@ -1064,6 +1070,9 @@ static struct my_option my_long_options[] =
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p', "Password to connect to remote server.", {"password", 'p', "Password to connect to remote server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in " {"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, " "order of preference, my.cnf, $MYSQL_TCP_PORT, "
#if MYSQL_PORT_DEFAULT == 0 #if MYSQL_PORT_DEFAULT == 0
...@@ -1381,6 +1390,12 @@ static Exit_status safe_connect() ...@@ -1381,6 +1390,12 @@ static Exit_status safe_connect()
return ERROR_STOP; return ERROR_STOP;
} }
if (opt_plugin_dir && *opt_plugin_dir)
mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
if (opt_default_auth && *opt_default_auth)
mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
if (opt_protocol) if (opt_protocol)
mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol); mysql_options(mysql, MYSQL_OPT_PROTOCOL, (char*) &opt_protocol);
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
......
...@@ -40,6 +40,7 @@ static int my_end_arg; ...@@ -40,6 +40,7 @@ static int my_end_arg;
static char * opt_mysql_unix_port = 0; static char * opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0, static char *opt_password = 0, *current_user = 0,
*default_charset= 0, *current_host= 0; *default_charset= 0, *current_host= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static int first_error = 0; static int first_error = 0;
DYNAMIC_ARRAY tables4repair; DYNAMIC_ARRAY tables4repair;
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
...@@ -99,6 +100,10 @@ static struct my_option my_long_options[] = ...@@ -99,6 +100,10 @@ static struct my_option my_long_options[] =
{"default-character-set", OPT_DEFAULT_CHARSET, {"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", &default_charset, "Set the default character set.", &default_charset,
&default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
(uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fast",'F', "Check only tables that haven't been closed properly.", {"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, &opt_fast, &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0}, 0},
...@@ -136,6 +141,9 @@ static struct my_option my_long_options[] = ...@@ -136,6 +141,9 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in " {"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, " "order of preference, my.cnf, $MYSQL_TCP_PORT, "
#if MYSQL_PORT_DEFAULT == 0 #if MYSQL_PORT_DEFAULT == 0
...@@ -796,6 +804,13 @@ static int dbConnect(char *host, char *user, char *passwd) ...@@ -796,6 +804,13 @@ static int dbConnect(char *host, char *user, char *passwd)
if (shared_memory_base_name) if (shared_memory_base_name)
mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); mysql_options(&mysql_connection,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif #endif
if (opt_plugin_dir && *opt_plugin_dir)
mysql_options(&mysql_connection, MYSQL_PLUGIN_DIR, opt_plugin_dir);
if (opt_default_auth && *opt_default_auth)
mysql_options(&mysql_connection, MYSQL_DEFAULT_AUTH, opt_default_auth);
mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset); mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd, if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd,
NULL, opt_mysql_port, opt_mysql_unix_port, 0))) NULL, opt_mysql_port, opt_mysql_unix_port, 0)))
......
...@@ -137,7 +137,7 @@ FILE *stderror_file=0; ...@@ -137,7 +137,7 @@ FILE *stderror_file=0;
static char *shared_memory_base_name=0; static char *shared_memory_base_name=0;
#endif #endif
static uint opt_protocol= 0; static uint opt_protocol= 0;
static char *opt_plugin_dir= 0, *opt_default_auth; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
/* /*
Dynamic_string wrapper functions. In this file use these Dynamic_string wrapper functions. In this file use these
...@@ -503,7 +503,7 @@ static struct my_option my_long_options[] = ...@@ -503,7 +503,7 @@ static struct my_option my_long_options[] =
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.", {"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0, (uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_PLUGIN_DIR, {"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.", "Default authentication client-side plugin to use.",
(uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0, (uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
......
...@@ -60,6 +60,7 @@ static char *opt_password=0, *current_user=0, ...@@ -60,6 +60,7 @@ static char *opt_password=0, *current_user=0,
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
static uint opt_mysql_port= 0, opt_protocol= 0; static uint opt_mysql_port= 0, opt_protocol= 0;
static char * opt_mysql_unix_port=0; static char * opt_mysql_unix_port=0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static longlong opt_ignore_lines= -1; static longlong opt_ignore_lines= -1;
#include <sslopt-vars.h> #include <sslopt-vars.h>
...@@ -90,6 +91,10 @@ static struct my_option my_long_options[] = ...@@ -90,6 +91,10 @@ static struct my_option my_long_options[] =
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
&debug_info_flag, &debug_info_flag, &debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
(uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delete", 'd', "First delete all rows from table.", &opt_delete, {"delete", 'd', "First delete all rows from table.", &opt_delete,
&opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB, {"fields-terminated-by", OPT_FTB,
...@@ -139,6 +144,9 @@ static struct my_option my_long_options[] = ...@@ -139,6 +144,9 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in " {"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, " "order of preference, my.cnf, $MYSQL_TCP_PORT, "
#if MYSQL_PORT_DEFAULT == 0 #if MYSQL_PORT_DEFAULT == 0
...@@ -429,6 +437,13 @@ static MYSQL *db_connect(char *host, char *database, ...@@ -429,6 +437,13 @@ static MYSQL *db_connect(char *host, char *database,
if (shared_memory_base_name) if (shared_memory_base_name)
mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
#endif #endif
if (opt_plugin_dir && *opt_plugin_dir)
mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
if (opt_default_auth && *opt_default_auth)
mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset); mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (!(mysql_real_connect(mysql,host,user,passwd, if (!(mysql_real_connect(mysql,host,user,passwd,
database,opt_mysql_port,opt_mysql_unix_port, database,opt_mysql_port,opt_mysql_unix_port,
......
...@@ -34,6 +34,7 @@ static my_bool debug_info_flag= 0, debug_check_flag= 0; ...@@ -34,6 +34,7 @@ static my_bool debug_info_flag= 0, debug_check_flag= 0;
static uint my_end_arg= 0; static uint my_end_arg= 0;
static uint opt_verbose=0; static uint opt_verbose=0;
static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
#ifdef HAVE_SMEM #ifdef HAVE_SMEM
static char *shared_memory_base_name=0; static char *shared_memory_base_name=0;
...@@ -124,6 +125,12 @@ int main(int argc, char **argv) ...@@ -124,6 +125,12 @@ int main(int argc, char **argv)
#endif #endif
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (opt_plugin_dir && *opt_plugin_dir)
mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
if (opt_default_auth && *opt_default_auth)
mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
if (!(mysql_real_connect(&mysql,host,user,opt_password, if (!(mysql_real_connect(&mysql,host,user,opt_password,
(first_argument_uses_wildcards) ? "" : (first_argument_uses_wildcards) ? "" :
argv[0],opt_mysql_port,opt_mysql_unix_port, argv[0],opt_mysql_port,opt_mysql_unix_port,
...@@ -182,6 +189,10 @@ static struct my_option my_long_options[] = ...@@ -182,6 +189,10 @@ static struct my_option my_long_options[] =
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.", {"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
&debug_info_flag, &debug_info_flag, &debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
(uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &host, &host, 0, GET_STR, {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
...@@ -195,6 +206,9 @@ static struct my_option my_long_options[] = ...@@ -195,6 +206,9 @@ static struct my_option my_long_options[] =
"Password to use when connecting to server. If password is not given, it's " "Password to use when connecting to server. If password is not given, it's "
"solicited on the tty.", "solicited on the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in " {"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, " "order of preference, my.cnf, $MYSQL_TCP_PORT, "
#if MYSQL_PORT_DEFAULT == 0 #if MYSQL_PORT_DEFAULT == 0
......
...@@ -122,6 +122,7 @@ static char *host= NULL, *opt_password= NULL, *user= NULL, ...@@ -122,6 +122,7 @@ static char *host= NULL, *opt_password= NULL, *user= NULL,
*pre_system= NULL, *pre_system= NULL,
*post_system= NULL, *post_system= NULL,
*opt_mysql_unix_port= NULL; *opt_mysql_unix_port= NULL;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
const char *delimiter= "\n"; const char *delimiter= "\n";
...@@ -338,6 +339,12 @@ int main(int argc, char **argv) ...@@ -338,6 +339,12 @@ int main(int argc, char **argv)
#endif #endif
mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset);
if (opt_plugin_dir && *opt_plugin_dir)
mysql_options(&mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir);
if (opt_default_auth && *opt_default_auth)
mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
if (!opt_only_print) if (!opt_only_print)
{ {
if (!(mysql_real_connect(&mysql, host, user, opt_password, if (!(mysql_real_connect(&mysql, host, user, opt_password,
...@@ -581,6 +588,10 @@ static struct my_option my_long_options[] = ...@@ -581,6 +588,10 @@ static struct my_option my_long_options[] =
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag, {"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag,
&debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
(uchar**) &opt_default_auth, (uchar**) &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", 'F', {"delimiter", 'F',
"Delimiter to use in SQL statements supplied in file or command line.", "Delimiter to use in SQL statements supplied in file or command line.",
&delimiter, &delimiter, 0, GET_STR, REQUIRED_ARG, &delimiter, &delimiter, 0, GET_STR, REQUIRED_ARG,
...@@ -620,6 +631,9 @@ static struct my_option my_long_options[] = ...@@ -620,6 +631,9 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG, {"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0}, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif #endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
(uchar**) &opt_plugin_dir, (uchar**) &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", &opt_mysql_port, {"port", 'P', "Port number to use for connection.", &opt_mysql_port,
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
0}, 0},
......
...@@ -319,7 +319,7 @@ Proxied_user ...@@ -319,7 +319,7 @@ Proxied_user
With_grant 1 With_grant 1
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
# #
# Bug#58139 : default-auth option not recognized in MySQL standardi # Bug#58139 : default-auth option not recognized in MySQL standard
# command line clients # command line clients
# #
# Executing 'mysql' # Executing 'mysql'
...@@ -328,4 +328,6 @@ FLUSH PRIVILEGES; ...@@ -328,4 +328,6 @@ FLUSH PRIVILEGES;
# Executing 'mysqladmin' # Executing 'mysqladmin'
mysqld is alive mysqld is alive
# Executing 'mysqldump' # Executing 'mysqldump'
# Executing 'mysql_upgrade'
The --upgrade-system-tables option was used, databases won't be touched.
End of 5.5 tests End of 5.5 tests
...@@ -395,7 +395,7 @@ FLUSH PRIVILEGES; ...@@ -395,7 +395,7 @@ FLUSH PRIVILEGES;
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
--echo # --echo #
--echo # Bug#58139 : default-auth option not recognized in MySQL standardi --echo # Bug#58139 : default-auth option not recognized in MySQL standard
--echo # command line clients --echo # command line clients
--echo # --echo #
...@@ -408,4 +408,7 @@ FLUSH PRIVILEGES; ...@@ -408,4 +408,7 @@ FLUSH PRIVILEGES;
--echo # Executing 'mysqldump' --echo # Executing 'mysqldump'
--exec $MYSQL_DUMP -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --compact --default-auth=auth_test_plugin $PLUGIN_AUTH_OPT test --exec $MYSQL_DUMP -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --compact --default-auth=auth_test_plugin $PLUGIN_AUTH_OPT test
--echo # Executing 'mysql_upgrade'
--exec $MYSQL_UPGRADE -u root -S $MASTER_MYSOCK -P $MASTER_MYPORT --default-auth=auth_test_plugin $PLUGIN_AUTH_OPT --skip-verbose --force --upgrade-system-tables
--echo End of 5.5 tests --echo End of 5.5 tests
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment