summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing Nian <tingynia@amazon.com>2022-05-03 17:25:48 +0000
committerDaniel Black <daniel@mariadb.org>2022-05-26 14:21:23 +1000
commit31e30329a368a32d9de202748987592cc86db241 (patch)
tree9ecca0e634f6e7ae47a3b35aeda75121fbeeb210
parentf85d488ad2132db7b294cde3909cb5992b752143 (diff)
downloadmariadb-git-31e30329a368a32d9de202748987592cc86db241.tar.gz
Add option --enable-cleartext-plugin to the MariaDB client
For compatibility reasons, add the option to the MariaDB client without any functional changes besides simply accepting the option and emitting a warning that it is obsolete. In MySQL this security related option is compulsory in certain use cases. When users switch to MariaDB, this client command that used to work starts failing without a sensible error message. In worst case users resort to re-installing the mysql client from MySQL. In MariaDB the option is obsolete and should simply be ignored. Users however don't have any opportunity to learn that unless the client program tells them so. Before: mysql --enable-cleartext-plugin ... mysql: unknown option '--enable-cleartext-plugin' (program terminates) After: mysql --enable-cleartext-plugin ... WARNING: option '--enable-cleartext-plugin' is obsolete. (program executes) All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
-rw-r--r--client/client_priv.h1
-rw-r--r--client/mysql.cc10
-rw-r--r--man/mysql.115
-rw-r--r--mysql-test/main/mysql.result5
-rw-r--r--mysql-test/main/mysql.test8
5 files changed, 38 insertions, 1 deletions
diff --git a/client/client_priv.h b/client/client_priv.h
index 5e764cc33fd..275d3c6853b 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -102,6 +102,7 @@ enum options_client
OPT_IGNORE_DATA,
OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS,
OPT_CHECK_IF_UPGRADE_NEEDED,
+ OPT_COMPATIBILTY_CLEARTEXT_PLUGIN,
OPT_MAX_CLIENT_OPTION /* should be always the last */
};
diff --git a/client/mysql.cc b/client/mysql.cc
index 558b54e3909..ea92c84e1d1 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1521,6 +1521,8 @@ static struct my_option my_long_options[] =
&delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, "Obsolete option. Exists only for MySQL compatibility.",
+ 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E', "Print the output of a query (rows) vertically.",
&vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
@@ -1817,6 +1819,14 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
printf("WARNING: --server-arg option not supported in this configuration.\n");
#endif
break;
+ case OPT_COMPATIBILTY_CLEARTEXT_PLUGIN:
+ /*
+ This option exists in MySQL client but not in MariaDB. Users switching from
+ MySQL might still have this option in their commands, and it will not work
+ in MariaDB unless it is handled. Therefore output a warning and continue.
+ */
+ printf("WARNING: option '--enable-cleartext-plugin' is obsolete.\n");
+ break;
case 'A':
opt_rehash= 0;
break;
diff --git a/man/mysql.1 b/man/mysql.1
index 3ae8fdf9d69..238106843ef 100644
--- a/man/mysql.1
+++ b/man/mysql.1
@@ -507,6 +507,21 @@ the section called \(lqMYSQL COMMANDS\(rq\&.
.sp -1
.IP \(bu 2.3
.\}
+.\" mysql: enable cleartext plugin option
+.\" enable cleartext plugin option: mysql
+\fB\-\-enable\-cleartext\-plugin\fR
+.sp
+Obsolete option\&. Exists only for MySQL compatibility\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
.\" mysql: execute option
.\" execute option: mysql
\fB\-\-execute=\fR\fB\fIstatement\fR\fR,
diff --git a/mysql-test/main/mysql.result b/mysql-test/main/mysql.result
index ec2760ce8a7..9b0936b5924 100644
--- a/mysql-test/main/mysql.result
+++ b/mysql-test/main/mysql.result
@@ -629,4 +629,7 @@ drop table t1;
#
# MDEV-15538 '-N' Produce html output wrong
#
-<TABLE BORDER=1><TR><TD>1</TD></TR></TABLE> \ No newline at end of file
+<TABLE BORDER=1><TR><TD>1</TD></TR></TABLE>
+WARNING: option '--enable-cleartext-plugin' is obsolete.
+1
+1
diff --git a/mysql-test/main/mysql.test b/mysql-test/main/mysql.test
index 1cb4977a32d..0f41add821a 100644
--- a/mysql-test/main/mysql.test
+++ b/mysql-test/main/mysql.test
@@ -708,3 +708,11 @@ drop table t1;
--echo # MDEV-15538 '-N' Produce html output wrong
--echo #
--exec $MYSQL -NHe "select 1 as a"
+
+
+#
+# Test obsolete option --enable-cleartext-plugin
+# This should proceed with a warning
+#
+--echo
+--exec $MYSQL test --enable-cleartext-plugin -e "select 1"