|
1 | 1 | /* |
2 | | - Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. |
| 2 | + Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. |
3 | 3 |
|
4 | 4 | This program is free software; you can redistribute it and/or modify |
5 | 5 | 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, |
42 | 42 | opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0, |
43 | 43 | opt_write_binlog= 1; |
44 | 44 | static uint verbose = 0, opt_mysql_port=0; |
| 45 | +static uint opt_enable_cleartext_plugin= 0; |
| 46 | +static my_bool using_opt_enable_cleartext_plugin= 0; |
45 | 47 | static int my_end_arg; |
46 | 48 | static char * opt_mysql_unix_port = 0; |
47 | 49 | static char *opt_password = 0, *current_user = 0, |
@@ -110,6 +112,10 @@ static struct my_option my_long_options[] = |
110 | 112 | "Default authentication client-side plugin to use.", |
111 | 113 | &opt_default_auth, &opt_default_auth, 0, |
112 | 114 | GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, |
| 115 | + {"enable_cleartext_plugin", OPT_ENABLE_CLEARTEXT_PLUGIN, |
| 116 | + "Enable/disable the clear text authentication plugin.", |
| 117 | + &opt_enable_cleartext_plugin, &opt_enable_cleartext_plugin, |
| 118 | + 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, |
113 | 119 | {"fast",'F', "Check only tables that haven't been closed properly.", |
114 | 120 | &opt_fast, &opt_fast, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, |
115 | 121 | 0}, |
@@ -326,6 +332,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), |
326 | 332 | verbose++; |
327 | 333 | break; |
328 | 334 | case 'V': print_version(); exit(0); |
| 335 | + case OPT_ENABLE_CLEARTEXT_PLUGIN: |
| 336 | + using_opt_enable_cleartext_plugin= TRUE; |
| 337 | + break; |
329 | 338 | case OPT_MYSQL_PROTOCOL: |
330 | 339 | opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, |
331 | 340 | opt->name); |
@@ -880,6 +889,10 @@ static int dbConnect(char *host, char *user, char *passwd) |
880 | 889 | if (opt_default_auth && *opt_default_auth) |
881 | 890 | mysql_options(&mysql_connection, MYSQL_DEFAULT_AUTH, opt_default_auth); |
882 | 891 |
|
| 892 | + if (using_opt_enable_cleartext_plugin) |
| 893 | + mysql_options(&mysql_connection, MYSQL_ENABLE_CLEARTEXT_PLUGIN, |
| 894 | + (char *) &opt_enable_cleartext_plugin); |
| 895 | + |
883 | 896 | mysql_options(&mysql_connection, MYSQL_SET_CHARSET_NAME, default_charset); |
884 | 897 | if (!(sock = mysql_real_connect(&mysql_connection, host, user, passwd, |
885 | 898 | NULL, opt_mysql_port, opt_mysql_unix_port, 0))) |
|
0 commit comments