summaryrefslogtreecommitdiff
path: root/mysql-test/suite/roles
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-11-04 13:37:39 +0100
committerSergei Golubchik <sergii@pisem.net>2013-11-04 13:37:39 +0100
commit79d2e6c82f5dfa2b5fd9f74d2129815b22ca819c (patch)
tree4070152e70f2270745448edaf36532c5ba5f882a /mysql-test/suite/roles
parent00ba619106ca11aef27b8203fc03da2ec6c96409 (diff)
downloadmariadb-git-79d2e6c82f5dfa2b5fd9f74d2129815b22ca819c.tar.gz
MDEV-5232 SET ROLE checks privileges differently from check_access()
use the same inconsistent priv_user@host pair for SET ROLE privilege checks, just as check_access() does
Diffstat (limited to 'mysql-test/suite/roles')
-rw-r--r--mysql-test/suite/roles/set_role-5232.result15
-rw-r--r--mysql-test/suite/roles/set_role-5232.test20
2 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/suite/roles/set_role-5232.result b/mysql-test/suite/roles/set_role-5232.result
new file mode 100644
index 00000000000..888a5f10c3d
--- /dev/null
+++ b/mysql-test/suite/roles/set_role-5232.result
@@ -0,0 +1,15 @@
+create user ''@localhost;
+create user c;
+grant select on mysql.* to c;
+create role r1;
+grant r1 to c;
+select user(), current_user();
+user() current_user()
+c@localhost @localhost
+select user from mysql.user group by user;
+ERROR 42000: SELECT command denied to user ''@'localhost' for table 'user'
+set role r1;
+ERROR OP000: Invalid role specification `r1`.
+drop role r1;
+drop user c;
+drop user ''@localhost;
diff --git a/mysql-test/suite/roles/set_role-5232.test b/mysql-test/suite/roles/set_role-5232.test
new file mode 100644
index 00000000000..c6cb3d925a4
--- /dev/null
+++ b/mysql-test/suite/roles/set_role-5232.test
@@ -0,0 +1,20 @@
+#
+# MDEV-5232 SET ROLE checks privileges differently from check_access()
+#
+--source include/not_embedded.inc
+create user ''@localhost;
+create user c;
+grant select on mysql.* to c;
+create role r1;
+grant r1 to c;
+connect (c,localhost,c,,,,,);
+select user(), current_user();
+--error ER_TABLEACCESS_DENIED_ERROR
+select user from mysql.user group by user;
+--error ER_INVALID_ROLE
+set role r1;
+disconnect c;
+connection default;
+drop role r1;
+drop user c;
+drop user ''@localhost;