diff options
-rw-r--r-- | mysql-test/r/bug46261.result | 8 | ||||
-rw-r--r-- | mysql-test/t/bug46261-master.opt | 1 | ||||
-rw-r--r-- | mysql-test/t/bug46261.test | 16 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 12 |
4 files changed, 37 insertions, 0 deletions
diff --git a/mysql-test/r/bug46261.result b/mysql-test/r/bug46261.result new file mode 100644 index 00000000000..f54b698e08f --- /dev/null +++ b/mysql-test/r/bug46261.result @@ -0,0 +1,8 @@ +# +# 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 diff --git a/mysql-test/t/bug46261-master.opt b/mysql-test/t/bug46261-master.opt new file mode 100644 index 00000000000..6be4269e809 --- /dev/null +++ b/mysql-test/t/bug46261-master.opt @@ -0,0 +1 @@ +--skip-grant-tables $EXAMPLE_PLUGIN_OPT diff --git a/mysql-test/t/bug46261.test b/mysql-test/t/bug46261.test new file mode 100644 index 00000000000..67bdc995850 --- /dev/null +++ b/mysql-test/t/bug46261.test @@ -0,0 +1,16 @@ +--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 diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 87c0adc3133..94a2b506207 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -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"; |