Commit 9ea55766 authored by Staale Smedseng's avatar Staale Smedseng

Bug#46261 Plugins can be installed with --skip-grant-tables

Previously installed dynamic plugins are explicitly not loaded
on startup with --skip-grant-tables enabled. However, INSTALL
PLUGIN/UNINSTALL PLUGIN commands are allowed, and result in
inconsistent error messages (reporting duplicate plugin or
plugin does not exist).

This patch adds a check for --skip-grant-tables mode, and
returns error ER_OPTION_PREVENTS_STATEMENT to the user when
the above commands are attempted.
parent f6210545
#
# Bug#46261 Plugins can be installed with --skip-grant-tables
#
INSTALL PLUGIN example SONAME 'ha_example.so';
ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
UNINSTALL PLUGIN example;
ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
End of 5.1 tests
--skip-grant-tables $EXAMPLE_PLUGIN_OPT
--source include/not_embedded.inc
--source include/have_example_plugin.inc
--echo #
--echo # Bug#46261 Plugins can be installed with --skip-grant-tables
--echo #
--replace_regex /\.dll/.so/
--error ER_OPTION_PREVENTS_STATEMENT
eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO;
--replace_regex /\.dll/.so/
--error ER_OPTION_PREVENTS_STATEMENT
eval UNINSTALL PLUGIN example;
--echo End of 5.1 tests
......@@ -1665,6 +1665,12 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl
struct st_plugin_int *tmp;
DBUG_ENTER("mysql_install_plugin");
if (opt_noacl)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
DBUG_RETURN(TRUE);
}
bzero(&tables, sizeof(tables));
tables.db= (char *)"mysql";
tables.table_name= tables.alias= (char *)"plugin";
......@@ -1741,6 +1747,12 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
struct st_plugin_int *plugin;
DBUG_ENTER("mysql_uninstall_plugin");
if (opt_noacl)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
DBUG_RETURN(TRUE);
}
bzero(&tables, sizeof(tables));
tables.db= (char *)"mysql";
tables.table_name= tables.alias= (char *)"plugin";
......
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