Skip to content

Commit a49a78c

Browse files
author
Arun Kuruvila
committed
Merge branch 'mysql-5.5' into mysql-5.6
2 parents 8d83902 + a86191c commit a49a78c

File tree

7 files changed

+160
-2
lines changed

7 files changed

+160
-2
lines changed

client/mysqlcheck.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -43,6 +43,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
4343
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
4444
opt_write_binlog= 1, opt_secure_auth=TRUE;
4545
static uint verbose = 0, opt_mysql_port=0;
46+
static uint opt_enable_cleartext_plugin= 0;
47+
static my_bool using_opt_enable_cleartext_plugin= 0;
4648
static int my_end_arg;
4749
static char * opt_mysql_unix_port = 0;
4850
static char *opt_password = 0, *current_user = 0,
@@ -116,6 +118,10 @@ static struct my_option my_long_options[] =
116118
"Default authentication client-side plugin to use.",
117119
&opt_default_auth, &opt_default_auth, 0,
118120
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
121+
{"enable_cleartext_plugin", OPT_ENABLE_CLEARTEXT_PLUGIN,
122+
"Enable/disable the clear text authentication plugin.",
123+
&opt_enable_cleartext_plugin, &opt_enable_cleartext_plugin,
124+
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
119125
{"fast",'F', "Check only tables that haven't been closed properly.",
120126
&opt_fast, &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
121127
0},
@@ -338,6 +344,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
338344
verbose++;
339345
break;
340346
case 'V': print_version(); exit(0);
347+
case OPT_ENABLE_CLEARTEXT_PLUGIN:
348+
using_opt_enable_cleartext_plugin= TRUE;
349+
break;
341350
case OPT_MYSQL_PROTOCOL:
342351
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
343352
opt->name);
@@ -907,6 +916,10 @@ static int dbConnect(char *host, char *user, char *passwd)
907916
if (opt_default_auth && *opt_default_auth)
908917
mysql_options(&mysql_connection, MYSQL_DEFAULT_AUTH, opt_default_auth);
909918

919+
if (using_opt_enable_cleartext_plugin)
920+
mysql_options(&mysql_connection, MYSQL_ENABLE_CLEARTEXT_PLUGIN,
921+
(char *) &opt_enable_cleartext_plugin);
922+
910923
mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset);
911924
mysql_options(&mysql_connection, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
912925
mysql_options4(&mysql_connection, MYSQL_OPT_CONNECT_ATTR_ADD,

client/mysqldump.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ static ulong opt_compatible_mode= 0;
131131
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
132132
#define MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL 1
133133
#define MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL 2
134+
static uint opt_enable_cleartext_plugin= 0;
135+
static my_bool using_opt_enable_cleartext_plugin= 0;
134136
static uint opt_mysql_port= 0, opt_master_data;
135137
static uint opt_slave_data;
136138
static uint my_end_arg;
@@ -546,6 +548,10 @@ static struct my_option my_long_options[] =
546548
"Default authentication client-side plugin to use.",
547549
&opt_default_auth, &opt_default_auth, 0,
548550
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
551+
{"enable_cleartext_plugin", OPT_ENABLE_CLEARTEXT_PLUGIN,
552+
"Enable/disable the clear text authentication plugin.",
553+
&opt_enable_cleartext_plugin, &opt_enable_cleartext_plugin,
554+
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
549555
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
550556
};
551557

@@ -916,6 +922,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
916922
default_charset= (char*) MYSQL_DEFAULT_CHARSET_NAME;
917923
break;
918924
}
925+
case (int) OPT_ENABLE_CLEARTEXT_PLUGIN:
926+
using_opt_enable_cleartext_plugin= TRUE;
927+
break;
919928
case (int) OPT_MYSQL_PROTOCOL:
920929
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
921930
opt->name);
@@ -1537,6 +1546,10 @@ static int connect_to_db(char *host, char *user,char *passwd)
15371546
if (opt_default_auth && *opt_default_auth)
15381547
mysql_options(&mysql_connection, MYSQL_DEFAULT_AUTH, opt_default_auth);
15391548

1549+
if (using_opt_enable_cleartext_plugin)
1550+
mysql_options(&mysql_connection, MYSQL_ENABLE_CLEARTEXT_PLUGIN,
1551+
(char *) &opt_enable_cleartext_plugin);
1552+
15401553
mysql_options(&mysql_connection, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
15411554
mysql_options4(&mysql_connection, MYSQL_OPT_CONNECT_ATTR_ADD,
15421555
"program_name", "mysqldump");

client/mysqlimport.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ static char *opt_password=0, *current_user=0,
5050
*lines_terminated=0, *enclosed=0, *opt_enclosed=0,
5151
*escaped=0, *opt_columns=0,
5252
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
53+
static uint opt_enable_cleartext_plugin= 0;
54+
static my_bool using_opt_enable_cleartext_plugin= 0;
5355
static uint opt_mysql_port= 0, opt_protocol= 0;
5456
static char *opt_bind_addr = NULL;
5557
static char * opt_mysql_unix_port=0;
@@ -93,6 +95,10 @@ static struct my_option my_long_options[] =
9395
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
9496
{"delete", 'd', "First delete all rows from table.", &opt_delete,
9597
&opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
98+
{"enable_cleartext_plugin", OPT_ENABLE_CLEARTEXT_PLUGIN,
99+
"Enable/disable the clear text authentication plugin.",
100+
&opt_enable_cleartext_plugin, &opt_enable_cleartext_plugin,
101+
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
96102
{"fields-terminated-by", OPT_FTB,
97103
"Fields in the input file are terminated by the given string.",
98104
&fields_terminated, &fields_terminated, 0,
@@ -242,6 +248,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
242248
opt_local_file=1;
243249
break;
244250
#endif
251+
case OPT_ENABLE_CLEARTEXT_PLUGIN:
252+
using_opt_enable_cleartext_plugin= TRUE;
253+
break;
245254
case OPT_MYSQL_PROTOCOL:
246255
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
247256
opt->name);
@@ -451,6 +460,10 @@ static MYSQL *db_connect(char *host, char *database,
451460
if (opt_default_auth && *opt_default_auth)
452461
mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
453462

463+
if (using_opt_enable_cleartext_plugin)
464+
mysql_options(mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN,
465+
(char*)&opt_enable_cleartext_plugin);
466+
454467
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
455468
mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
456469
mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,

client/mysqlshow.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -38,6 +38,8 @@ static uint my_end_arg= 0;
3838
static uint opt_verbose=0;
3939
static char *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
4040
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
41+
static uint opt_enable_cleartext_plugin= 0;
42+
static my_bool using_opt_enable_cleartext_plugin= 0;
4143
static my_bool opt_secure_auth= TRUE;
4244

4345
#ifdef HAVE_SMEM
@@ -147,6 +149,10 @@ int main(int argc, char **argv)
147149
if (opt_default_auth && *opt_default_auth)
148150
mysql_options(&mysql, MYSQL_DEFAULT_AUTH, opt_default_auth);
149151

152+
if (using_opt_enable_cleartext_plugin)
153+
mysql_options(&mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN,
154+
(char*)&opt_enable_cleartext_plugin);
155+
150156
mysql_options(&mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
151157
mysql_options4(&mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
152158
"program_name", "mysqlshow");
@@ -215,6 +221,10 @@ static struct my_option my_long_options[] =
215221
"Default authentication client-side plugin to use.",
216222
&opt_default_auth, &opt_default_auth, 0,
217223
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
224+
{"enable_cleartext_plugin", OPT_ENABLE_CLEARTEXT_PLUGIN,
225+
"Enable/disable the clear text authentication plugin.",
226+
&opt_enable_cleartext_plugin, &opt_enable_cleartext_plugin,
227+
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
218228
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG,
219229
0, 0, 0, 0, 0, 0},
220230
{"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
@@ -332,6 +342,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
332342
opt_protocol = MYSQL_PROTOCOL_PIPE;
333343
#endif
334344
break;
345+
case (int) OPT_ENABLE_CLEARTEXT_PLUGIN:
346+
using_opt_enable_cleartext_plugin= TRUE;
347+
break;
335348
case OPT_MYSQL_PROTOCOL:
336349
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
337350
opt->name);
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#
2+
# Bug #21235226 : THE --ENABLE-CLEARTEXT-PLUGIN IS NOT IMPLEMENTED
3+
# IN ALL CLIENT PROGRAMS
4+
#
5+
CREATE DATABASE db21235226;
6+
USE db21235226;
7+
CREATE TABLE t1(a INT);
8+
INSERT INTO t1 VALUES (1), (2);
9+
SELECT * FROM t1;
10+
a
11+
1
12+
2
13+
CREATE USER uplain@localhost IDENTIFIED WITH 'cleartext_plugin_server'
14+
AS 'cleartext_test';
15+
GRANT ALL PRIVILEGES ON *.* TO uplain@localhost;
16+
Warning: Using a password on the command line interface can be insecure.
17+
mysqldump: Got error: 2059: Authentication plugin 'mysql_clear_password' cannot be loaded: plugin not enabled when trying to connect
18+
SELECT * FROM t1;
19+
a
20+
Warning: Using a password on the command line interface can be insecure.
21+
mysqlimport: Error: 2059 Authentication plugin 'mysql_clear_password' cannot be loaded: plugin not enabled
22+
SELECT * FROM t1;
23+
a
24+
1
25+
2
26+
Warning: Using a password on the command line interface can be insecure.
27+
mysqlshow: Authentication plugin 'mysql_clear_password' cannot be loaded: plugin not enabled
28+
Database: db21235226
29+
+--------+
30+
| Tables |
31+
+--------+
32+
| t1 |
33+
+--------+
34+
Warning: Using a password on the command line interface can be insecure.
35+
mysqlcheck: Got error: 2059: Authentication plugin 'mysql_clear_password' cannot be loaded: plugin not enabled when trying to connect
36+
db21235226.t1 OK
37+
DROP TABLE t1;
38+
DROP DATABASE db21235226;
39+
DROP USER uplain@localhost;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
$PLUGIN_AUTH_OPT
2+
$PLUGIN_AUTH_LOAD
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
--source include/have_plugin_auth.inc
2+
--source include/not_embedded.inc
3+
4+
--echo #
5+
--echo # Bug #21235226 : THE --ENABLE-CLEARTEXT-PLUGIN IS NOT IMPLEMENTED
6+
--echo # IN ALL CLIENT PROGRAMS
7+
--echo #
8+
9+
CREATE DATABASE db21235226;
10+
USE db21235226;
11+
12+
CREATE TABLE t1(a INT);
13+
INSERT INTO t1 VALUES (1), (2);
14+
SELECT * FROM t1;
15+
16+
CREATE USER uplain@localhost IDENTIFIED WITH 'cleartext_plugin_server'
17+
AS 'cleartext_test';
18+
19+
GRANT ALL PRIVILEGES ON *.* TO uplain@localhost;
20+
21+
#Reset the LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN variable.
22+
let LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN=N;
23+
24+
#Scenario 1 : MYSQL_DUMP without --enable_cleartext_plugin
25+
# Should get CR_AUTH_PLUGIN_CANNOT_LOAD error
26+
--error 2
27+
--exec $MYSQL_DUMP --user=uplain --password=cleartext_test --tab=$MYSQLTEST_VARDIR/tmp/ db21235226 2>&1
28+
29+
#Scenario 2 : MYSQL_DUMP with --enable_cleartext_plugin
30+
--exec $MYSQL_DUMP --enable_cleartext_plugin --user=uplain --password=cleartext_test --tab=$MYSQLTEST_VARDIR/tmp/ db21235226
31+
--exec $MYSQL --enable_cleartext_plugin --user=uplain --password=cleartext_test db21235226 < $MYSQLTEST_VARDIR/tmp/t1.sql
32+
SELECT * FROM t1;
33+
34+
#Scenario 3 : MYSQL_IMPORT without --enable_cleartext_plugin
35+
# Should get CR_AUTH_PLUGIN_CANNOT_LOAD error
36+
--replace_regex /.*mysqlimport(\.exe)*/mysqlimport/
37+
--error 1
38+
--exec $MYSQL_IMPORT --user=uplain --password=cleartext_test --silent db21235226 $MYSQLTEST_VARDIR/tmp/t1.txt 2>&1
39+
40+
#Scenario 4 : MYSQL_IMPORT with --enable_cleartext_plugin
41+
--exec $MYSQL_IMPORT --enable_cleartext_plugin --user=uplain --password=cleartext_test --silent db21235226 $MYSQLTEST_VARDIR/tmp/t1.txt
42+
SELECT * FROM t1;
43+
44+
#Scenario 5 : MYSQL_SHOW without --enable_cleartext_plugin
45+
# Should get CR_AUTH_PLUGIN_CANNOT_LOAD error
46+
--replace_regex /.*mysqlshow(\.exe)*/mysqlshow/
47+
--error 1
48+
--exec $MYSQL_SHOW --user=uplain --password=cleartext_test db21235226 2>&1
49+
50+
#Scenario 6 : MYSQL_SHOW with --enable_cleartext_plugin
51+
--exec $MYSQL_SHOW --enable_cleartext_plugin --user=uplain --password=cleartext_test db21235226
52+
53+
#Scenario 7 : MYSQL_CHECK without --enable_cleartext_plugin
54+
# Should get CR_AUTH_PLUGIN_CANNOT_LOAD error
55+
--replace_regex /.*mysqlcheck(\.exe)*/mysqlcheck/
56+
--error 2
57+
--exec $MYSQL_CHECK --user=uplain --password=cleartext_test db21235226 t1 2>&1
58+
59+
#Scenario 8 : MYSQL_CHECK with --enable_cleartext_plugin
60+
--exec $MYSQL_CHECK --enable_cleartext_plugin --user=uplain --password=cleartext_test db21235226 t1
61+
62+
#Cleanup
63+
DROP TABLE t1;
64+
DROP DATABASE db21235226;
65+
DROP USER uplain@localhost;

0 commit comments

Comments
 (0)