summaryrefslogtreecommitdiff
path: root/mysql-test/t/plugin_not_embedded.test
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-03-09 09:16:17 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-03-09 09:16:17 -0300
commit81ffd72a5821f07129dedf4c31c3cbc2abfac372 (patch)
treeecfbd1b8044d79d00e31e36aab2dd8fc1baa4063 /mysql-test/t/plugin_not_embedded.test
parentb8132a8d946bde553834c37785bbe53008f1e925 (diff)
downloadmariadb-git-81ffd72a5821f07129dedf4c31c3cbc2abfac372.tar.gz
Bug#51770: UNINSTALL PLUGIN requires no privileges
The problem was that UNINSTALL PLUGIN wasn't performing privilege checks before removing a plugin. Any user (including users without any kind of privileges) could uninstall any plugin. The solution is to verify if the user has the DELETE privilege for the mysql.plugin table before uninstalling a plugin. mysql-test/r/plugin_not_embedded.result: Add test case result for Bug#51770. mysql-test/t/plugin_not_embedded-master.opt: Add example plugin path. mysql-test/t/plugin_not_embedded.test: Add test case for Bug#51770. Skip embedded as test relies on privileges checks.
Diffstat (limited to 'mysql-test/t/plugin_not_embedded.test')
-rw-r--r--mysql-test/t/plugin_not_embedded.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/t/plugin_not_embedded.test b/mysql-test/t/plugin_not_embedded.test
new file mode 100644
index 00000000000..eea7deab40c
--- /dev/null
+++ b/mysql-test/t/plugin_not_embedded.test
@@ -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;