#At file:///export/home/tmp/ss156133/z/46261-51/ based on revid:kristofer.pettersson@stripped
3356 Staale Smedseng 2010-04-22
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.
added:
mysql-test/r/bug46261.result
mysql-test/t/bug46261-master.opt
mysql-test/t/bug46261.test
modified:
sql/sql_plugin.cc
=== added file 'mysql-test/r/bug46261.result'
--- a/mysql-test/r/bug46261.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/bug46261.result 2010-04-22 13:52:00 +0000
@@ -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
=== added file 'mysql-test/t/bug46261-master.opt'
--- a/mysql-test/t/bug46261-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug46261-master.opt 2010-04-22 13:52:00 +0000
@@ -0,0 +1 @@
+--skip-grant-tables $EXAMPLE_PLUGIN_OPT
=== added file 'mysql-test/t/bug46261.test'
--- a/mysql-test/t/bug46261.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug46261.test 2010-04-22 13:52:00 +0000
@@ -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
=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc 2010-04-16 13:02:23 +0000
+++ b/sql/sql_plugin.cc 2010-04-22 13:52:00 +0000
@@ -1665,6 +1665,12 @@ bool mysql_install_plugin(THD *thd, cons
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, co
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";
Attachment: [text/bzr-bundle] bzr/staale.smedseng@sun.com-20100422135200-zve31ij6915adygk.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (staale.smedseng:3356) Bug#46261 | Staale Smedseng | 22 Apr |