* Davi Arnaut <Davi.Arnaut@stripped> [10/03/09 15:42]:
> +GRANT DELETE ON mysql.plugin TO bug51770@localhost;
> +FLUSH PRIVILEGES;
You don't need to FLUSH privileges after GRANT. Only if you
hand-update the grant tables.
> +UNINSTALL PLUGIN example;
> +DROP USER bug51770@localhost;
>
> === added file 'mysql-test/t/plugin_not_embedded.test'
> --- a/mysql-test/t/plugin_not_embedded.test 1970-01-01 00:00:00 +0000
> +++ b/mysql-test/t/plugin_not_embedded.test 2010-03-09 12:16:17 +0000
> @@ -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;
OK to push.
>
> === modified file 'sql/sql_plugin.cc'
> --- a/sql/sql_plugin.cc 2009-12-18 19:14:09 +0000
> +++ b/sql/sql_plugin.cc 2010-03-09 12:16:17 +0000
> @@ -1736,6 +1736,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)))