summaryrefslogtreecommitdiff
path: root/mysql-test/main/grant_missing.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/grant_missing.test')
-rw-r--r--mysql-test/main/grant_missing.test116
1 files changed, 116 insertions, 0 deletions
diff --git a/mysql-test/main/grant_missing.test b/mysql-test/main/grant_missing.test
new file mode 100644
index 00000000000..c62f7f43e11
--- /dev/null
+++ b/mysql-test/main/grant_missing.test
@@ -0,0 +1,116 @@
+
+--echo #
+--echo # MDEV-22133: handle_fatal_signal (sig=11) on optimized builds in
+--echo # handle_grant_table instead of ERROR | Buffer overflow
+--echo # (on optimized builds)
+--echo #
+
+call mtr.add_suppression("Missing system table mysql.pro");
+call mtr.add_suppression("Missing system table mysql.roles_mapping");
+call mtr.add_suppression("Can't open and lock privilege tables");
+
+create user b@localhost;
+create table t(a int);
+create procedure p() select 1;
+grant EXECUTE on PROCEDURE test.p to b@localhost;
+GRANT PROXY ON 'root'@'%' TO b@localhost;
+grant SELECT(a) on test.t to b@localhost;
+grant DELETE on test.t to b@localhost;
+grant UPDATE on test.* to b@localhost;
+
+RENAME TABLE mysql.procs_priv TO mysql.procs_gone;
+CREATE USER a@localhost;
+drop user a@localhost;
+--error ER_NO_SUCH_TABLE
+revoke EXECUTE on PROCEDURE test.p from b@localhost;
+--error ER_NO_SUCH_TABLE
+grant EXECUTE on PROCEDURE test.p to b@localhost;
+flush privileges;
+RENAME TABLE mysql.procs_gone TO mysql.procs_priv;
+flush privileges;
+
+rename table mysql.proxies_priv to mysql.proxies_gone;
+CREATE USER a@localhost;
+drop user a@localhost;
+--error ER_NO_SUCH_TABLE
+REVOKE PROXY ON 'root'@'%' FROM b@localhost;
+--error ER_NO_SUCH_TABLE
+GRANT PROXY ON 'root'@'%' TO b@localhost;
+flush privileges;
+rename table mysql.proxies_gone to mysql.proxies_priv;
+flush privileges;
+
+rename table mysql.columns_priv to mysql.columns_gone;
+--error ER_NO_SUCH_TABLE
+CREATE USER a@localhost;
+--error ER_NO_SUCH_TABLE
+drop user a@localhost;
+--error ER_NO_SUCH_TABLE
+revoke SELECT(a) on test.t from b@localhost;
+--error ER_NO_SUCH_TABLE
+grant SELECT(a) on test.t to b@localhost;
+--error ER_NO_SUCH_TABLE
+flush privileges;
+rename table mysql.columns_gone to mysql.columns_priv;
+flush privileges;
+
+rename table mysql.tables_priv to mysql.tables_gone;
+--error ER_NO_SUCH_TABLE
+CREATE USER a@localhost;
+--error ER_NO_SUCH_TABLE
+drop user a@localhost;
+--error ER_NO_SUCH_TABLE
+revoke DELETE on test.t from b@localhost;
+--error ER_NO_SUCH_TABLE
+grant DELETE on test.t to b@localhost;
+--error ER_NO_SUCH_TABLE
+flush privileges;
+rename table mysql.tables_gone to mysql.tables_priv;
+flush privileges;
+
+rename table mysql.db to mysql.db_gone;
+--error ER_NO_SUCH_TABLE
+CREATE USER a@localhost;
+--error ER_NO_SUCH_TABLE
+drop user a@localhost;
+--error ER_NO_SUCH_TABLE
+revoke UPDATE on test.* from b@localhost;
+--error ER_NO_SUCH_TABLE
+grant UPDATE on test.* to b@localhost;
+--error ER_NO_SUCH_TABLE
+flush privileges;
+rename table mysql.db_gone to mysql.db;
+flush privileges;
+
+--echo # Host table silently ignored bacause it can be absent in MySQL
+rename table mysql.host to mysql.host_gone;
+CREATE USER a@localhost;
+drop user a@localhost;
+flush privileges;
+rename table mysql.host_gone to mysql.host;
+flush privileges;
+
+rename table mysql.roles_mapping to mysql.roles_mapping_gone;
+CREATE USER a@localhost;
+drop user a@localhost;
+flush privileges;
+rename table mysql.roles_mapping_gone to mysql.roles_mapping;
+flush privileges;
+
+rename table mysql.user to mysql.user_gone;
+--error ER_NO_SUCH_TABLE
+CREATE USER a@localhost;
+--error ER_NO_SUCH_TABLE
+drop user a@localhost;
+--error ER_NO_SUCH_TABLE
+flush privileges;
+rename table mysql.user_gone to mysql.user;
+flush privileges;
+
+drop user b@localhost;
+drop table t;
+drop procedure p;
+
+--echo #
+--echo # End of 10.3 tests
+--echo #