Commit aa509562 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-7781 cannot install/uninstall plugins during bootstrap

Merge branch 'openquery:mdev-7781-allow-install-uninstall-plugins-during-bootstrap' into 10.0
Undo MySQL fix for bug#46261
parents c8c51cee dbe97bcc
...@@ -15,3 +15,14 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' ...@@ -15,3 +15,14 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
and SUPPORT='YES'; and SUPPORT='YES';
End of 5.5 tests End of 5.5 tests
flush tables;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select * from mysql.plugin;
name dl
EXAMPLE ha_example.so
truncate table mysql.plugin;
#
# Bug#46261 Plugins can be installed with --skip-grant-tables
#
INSTALL PLUGIN example SONAME 'ha_example.so';
ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
UNINSTALL PLUGIN example;
ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
End of 5.1 tests
...@@ -60,3 +60,32 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' ...@@ -60,3 +60,32 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'
and SUPPORT='YES'; and SUPPORT='YES';
--echo End of 5.5 tests --echo End of 5.5 tests
--source include/not_windows_embedded.inc
--source include/have_example_plugin.inc
#
# Check that --bootstrap can install and uninstall plugins
#
let $PLUGIN_DIR=`select @@plugin_dir`;
--write_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
install soname 'ha_example';
uninstall plugin unusable;
EOF
--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/install_plugin.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/install_plugin.sql
#
# Check that installed plugins are *not* automatically loaded in --bootstrap
#
--write_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
use test;
create table t1(a int) engine=example;
EOF
--exec $MYSQLD_BOOTSTRAP_CMD --plugin-dir=$PLUGIN_DIR < $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_plugins.sql
flush tables;
show create table t1;
drop table t1;
--replace_result .dll .so
select * from mysql.plugin;
truncate table mysql.plugin;
--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
...@@ -2085,14 +2085,8 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, ...@@ -2085,14 +2085,8 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
char **argv=orig_argv; char **argv=orig_argv;
DBUG_ENTER("mysql_install_plugin"); DBUG_ENTER("mysql_install_plugin");
if (opt_noacl)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
DBUG_RETURN(TRUE);
}
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE); tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
if (check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE)) if (!opt_noacl && check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
/* need to open before acquiring LOCK_plugin or it will deadlock */ /* need to open before acquiring LOCK_plugin or it will deadlock */
...@@ -2227,15 +2221,9 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name, ...@@ -2227,15 +2221,9 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
bool error= false; bool error= false;
DBUG_ENTER("mysql_uninstall_plugin"); DBUG_ENTER("mysql_uninstall_plugin");
if (opt_noacl)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
DBUG_RETURN(TRUE);
}
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE); tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
if (check_table_access(thd, DELETE_ACL, &tables, FALSE, 1, FALSE)) if (!opt_noacl && check_table_access(thd, DELETE_ACL, &tables, FALSE, 1, FALSE))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
/* need to open before acquiring LOCK_plugin or it will deadlock */ /* need to open before acquiring LOCK_plugin or it will deadlock */
......
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