summaryrefslogtreecommitdiff
path: root/mysql-test/t/events.test
diff options
context:
space:
mode:
authorunknown <andrey@lmy004.>2006-02-10 15:02:57 +0100
committerunknown <andrey@lmy004.>2006-02-10 15:02:57 +0100
commit5b497b163aff1ba23af4f97528be832af55c3c21 (patch)
tree36b814f55a927eda9e28b47961f29e224033fd61 /mysql-test/t/events.test
parent094fcd2611b3a171a64b5d20a4b851cdba2c55e7 (diff)
downloadmariadb-git-5b497b163aff1ba23af4f97528be832af55c3c21.tar.gz
fix for bug #17289 Events: missing privilege check for drop database
Events were executed with all privileges possible on planet Earth :( WL#1034 mysql-test/r/events.result: update test results mysql-test/t/events.test: test for bug#17289 Events: missing privilege check for drop database sql/event.h: -add two new methods to event_timed to change and restore the security context sql/event_executor.cc: - move code regarding privilieges checking to event_timed::execute() - add a new function evex_print_warnings() which prints the notes/warnings/errors to the console (easily capturable with logs-into-tables) so one can see what has happened if there was an error of some sort! sql/event_timed.cc: - fix documentation - add a new error code -99, EVENT was revoked from the user on the DB - set_sec_ctx, execute, restore_sex_ctx sql/sql_error.cc: - make warning_level_names public to be used in event_executor.cc - change from 2 arrays to a LEX_STRING array
Diffstat (limited to 'mysql-test/t/events.test')
-rw-r--r--mysql-test/t/events.test33
1 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test
index aa759d5ca6f..5a58d29e0ff 100644
--- a/mysql-test/t/events.test
+++ b/mysql-test/t/events.test
@@ -1,5 +1,38 @@
create database if not exists events_test;
use events_test;
+
+#
+# START: BUG #17289 Events: missing privilege check for drop database
+#
+CREATE USER pauline@localhost;
+CREATE DATABASE db_x;
+GRANT EVENT ON db_x.* TO pauline@localhost;
+USE db_x;
+CREATE TABLE x_table(a int);
+connect (priv_conn,localhost,pauline,,db_x);
+CREATE EVENT e_x1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db_x;
+CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table;
+connection default;
+SHOW DATABASES LIKE 'db_x';
+SET GLOBAL event_scheduler=1;
+--sleep 2
+SHOW DATABASES LIKE 'db_x';
+SHOW TABLES FROM db_x;
+SET GLOBAL event_scheduler=0;
+--sleep 1
+connection priv_conn;
+DROP EVENT e_x1;
+DROP EVENT e_x2;
+disconnect priv_conn;
+connection default;
+DROP DATABASE db_x;
+DROP USER pauline@localhost;
+USE events_test;
+--sleep 1
+#
+# END: BUG #17289 Events: missing privilege check for drop database
+#
+
drop event if exists event1;
create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
alter event event1 rename to event2 enable;