diff -Naurp mysql-cluster-gpl-7.1.3/mysql-test/r/plugin_not_embedded.result mysql-cluster-gpl-7.1.3.oden/mysql-test/r/plugin_not_embedded.result --- mysql-cluster-gpl-7.1.3/mysql-test/r/plugin_not_embedded.result 1970-01-01 01:00:00.000000000 +0100 +++ mysql-cluster-gpl-7.1.3.oden/mysql-test/r/plugin_not_embedded.result 2010-05-26 13:53:21.873332202 +0200 @@ -0,0 +1,11 @@ +# +# Bug#51770: UNINSTALL PLUGIN requires no privileges +# +GRANT INSERT ON mysql.plugin TO bug51770@localhost; +INSTALL PLUGIN example SONAME 'ha_example.so'; +UNINSTALL PLUGIN example; +ERROR 42000: DELETE command denied to user 'bug51770'@'localhost' for table 'plugin' +GRANT DELETE ON mysql.plugin TO bug51770@localhost; +FLUSH PRIVILEGES; +UNINSTALL PLUGIN example; +DROP USER bug51770@localhost; diff -Naurp mysql-cluster-gpl-7.1.3/mysql-test/t/plugin_not_embedded-master.opt mysql-cluster-gpl-7.1.3.oden/mysql-test/t/plugin_not_embedded-master.opt --- mysql-cluster-gpl-7.1.3/mysql-test/t/plugin_not_embedded-master.opt 1970-01-01 01:00:00.000000000 +0100 +++ mysql-cluster-gpl-7.1.3.oden/mysql-test/t/plugin_not_embedded-master.opt 2010-05-26 13:53:21.873332202 +0200 @@ -0,0 +1 @@ +$EXAMPLE_PLUGIN_OPT diff -Naurp mysql-cluster-gpl-7.1.3/mysql-test/t/plugin_not_embedded.test mysql-cluster-gpl-7.1.3.oden/mysql-test/t/plugin_not_embedded.test --- mysql-cluster-gpl-7.1.3/mysql-test/t/plugin_not_embedded.test 1970-01-01 01:00:00.000000000 +0100 +++ mysql-cluster-gpl-7.1.3.oden/mysql-test/t/plugin_not_embedded.test 2010-05-26 13:53:21.874331837 +0200 @@ -0,0 +1,20 @@ +--source include/not_embedded.inc +--source include/have_example_plugin.inc + +--echo # +--echo # Bug#51770: UNINSTALL PLUGIN requires no privileges +--echo # + +GRANT INSERT ON mysql.plugin TO bug51770@localhost; +connect(con1,localhost,bug51770,,); +eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO; +--error ER_TABLEACCESS_DENIED_ERROR +UNINSTALL PLUGIN example; +connection default; +GRANT DELETE ON mysql.plugin TO bug51770@localhost; +FLUSH PRIVILEGES; +connection con1; +UNINSTALL PLUGIN example; +disconnect con1; +connection default; +DROP USER bug51770@localhost; diff -Naurp mysql-cluster-gpl-7.1.3/sql/sql_plugin.cc mysql-cluster-gpl-7.1.3.oden/sql/sql_plugin.cc --- mysql-cluster-gpl-7.1.3/sql/sql_plugin.cc 2010-03-29 16:51:28.000000000 +0200 +++ mysql-cluster-gpl-7.1.3.oden/sql/sql_plugin.cc 2010-05-26 13:53:21.874331837 +0200 @@ -1739,6 +1739,8 @@ bool mysql_uninstall_plugin(THD *thd, co bzero(&tables, sizeof(tables)); tables.db= (char *)"mysql"; tables.table_name= tables.alias= (char *)"plugin"; + if (check_table_access(thd, DELETE_ACL, &tables, 1, FALSE)) + DBUG_RETURN(TRUE); /* need to open before acquiring LOCK_plugin or it will deadlock */ if (! (table= open_ltable(thd, &tables, TL_WRITE, 0)))