summaryrefslogtreecommitdiff
path: root/mysql-test/r/events_bugs.result
diff options
context:
space:
mode:
authorunknown <andrey@lmy004.>2006-06-23 17:29:01 +0200
committerunknown <andrey@lmy004.>2006-06-23 17:29:01 +0200
commitd6cf50ca8b6fa7d4ddec56f2403ee8ada2e0c9ab (patch)
treeee00f13082b79397694f09b4c7f575884ea81448 /mysql-test/r/events_bugs.result
parentf684f86b827470a2a2d68cb79843a3a2dbced0f5 (diff)
downloadmariadb-git-d6cf50ca8b6fa7d4ddec56f2403ee8ada2e0c9ab.tar.gz
Fix for bug #18897 "Events: unauthorized action possible with
alter event rename". ALTER EVENT ... RENAME statement hasn't checked privileges for the target database. It also caused server crashes when target database was not specified explicitly and there was no current database. This fix adds missing privilege check and check for the case when target database is not specified explicitly or implicitly. mysql-test/r/events_bugs.result: update result mysql-test/t/events_bugs.test: add test case for bug 18897 Events: unauthorized action possible with alter event rename: - test rename to db the user does not have access to - test rename when there is no selected db sql/sql_parse.cc: Additional check for the situation when no db is selected. CREATE EVENT abc and ALTER EVENT db.abc RENAME TO xyz, and DROP EVENT abc won't work if there is no selected DB.
Diffstat (limited to 'mysql-test/r/events_bugs.result')
-rw-r--r--mysql-test/r/events_bugs.result23
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
index bc89c692f9a..a7c2964a253 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -178,4 +178,27 @@ drop procedure ee_16407_6_pendant;
set global event_scheduler= 2;
drop table events_smode_test;
set sql_mode=@old_sql_mode;
+set global event_scheduler=2;
+delete from mysql.user where User like 'mysqltest_%';
+delete from mysql.db where User like 'mysqltest_%';
+flush privileges;
+drop database if exists mysqltest_db1;
+create user mysqltest_user1@localhost;
+create database mysqltest_db1;
+grant event on events_test.* to mysqltest_user1@localhost;
+create event mysqltest_user1 on schedule every 10 second do select 42;
+alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1;
+ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db1'
+"Let's test now rename when there is no select DB"
+select database();
+database()
+NULL
+alter event events_test.mysqltest_user1 rename to mysqltest_user1;
+ERROR 3D000: No database selected
+select event_schema, event_name, definer, event_type, status from information_schema.events;
+event_schema event_name definer event_type status
+events_test mysqltest_user1 mysqltest_user1@localhost RECURRING ENABLED
+drop event events_test.mysqltest_user1;
+drop user mysqltest_user1@localhost;
+drop database mysqltest_db1;
drop database events_test;