diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-11-02 16:26:01 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-11-02 16:26:01 +0100 |
commit | 1f0368658b8992c88e2f6304de80f11be097ba1a (patch) | |
tree | b6fcd3f09b6898946930a9563f47d425a2ed9c4c /mysql-test/suite/roles | |
parent | f4d5d849fd3b526d38ca6eb083fd0b290eb0eda7 (diff) | |
download | mariadb-git-1f0368658b8992c88e2f6304de80f11be097ba1a.tar.gz |
MDEV-5225 Server crashes on CREATE USER|ROLE CURRENT_ROLE or DROP ROLE CURRENT_ROLE
Diffstat (limited to 'mysql-test/suite/roles')
-rw-r--r-- | mysql-test/suite/roles/create_and_drop_current.result | 39 | ||||
-rw-r--r-- | mysql-test/suite/roles/create_and_drop_current.test | 52 |
2 files changed, 91 insertions, 0 deletions
diff --git a/mysql-test/suite/roles/create_and_drop_current.result b/mysql-test/suite/roles/create_and_drop_current.result new file mode 100644 index 00000000000..fa319440080 --- /dev/null +++ b/mysql-test/suite/roles/create_and_drop_current.result @@ -0,0 +1,39 @@ +grant create user on *.* to foo@localhost; +create user current_user; +ERROR HY000: Operation CREATE USER failed for CURRENT_USER +create user current_role; +ERROR HY000: Operation CREATE USER failed for CURRENT_ROLE +create role current_user; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'current_user' at line 1 +create role current_role; +ERROR HY000: Operation CREATE ROLE failed for CURRENT_ROLE +drop user current_user; +drop user current_role; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'current_role' at line 1 +drop role current_user; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'current_user' at line 1 +drop role current_role; +ERROR HY000: Operation DROP ROLE failed for CURRENT_ROLE +show warnings; +Level Code Message +Error 1446 Invalid definer +Error 1396 Operation DROP ROLE failed for CURRENT_ROLE +create role r1; +grant r1 to current_user; +set role r1; +select current_role(); +current_role() +r1 +create user current_role; +ERROR HY000: Operation CREATE USER failed for CURRENT_ROLE +create role current_role; +ERROR HY000: Operation CREATE ROLE failed for CURRENT_ROLE +drop user current_role; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'current_role' at line 1 +drop role current_role; +select user,host,is_role from mysql.user; +user host is_role +root localhost N +root meddwl N +root 127.0.0.1 N +root ::1 N diff --git a/mysql-test/suite/roles/create_and_drop_current.test b/mysql-test/suite/roles/create_and_drop_current.test new file mode 100644 index 00000000000..ad606376615 --- /dev/null +++ b/mysql-test/suite/roles/create_and_drop_current.test @@ -0,0 +1,52 @@ +# +# MDEV-5225 Server crashes on CREATE USER|ROLE CURRENT_ROLE or DROP ROLE CURRENT_ROLE +# + +# Where CURRENT_USER/CURRENT_ROLE is explicitly allowed by the grammar +# the error (if any) should be ER_CANNOT_USER +# +# Where it's not explicitly allowed, the error is ER_PARSE_ERROR, +# because CURRENT_USER/CURRENT_ROLE are reserved words and cannot be +# accepted as an identifier. +# + +--source include/not_embedded.inc + +grant create user on *.* to foo@localhost; +--change_user foo + +--error ER_CANNOT_USER +create user current_user; +--error ER_CANNOT_USER +create user current_role; +--error ER_PARSE_ERROR +create role current_user; +--error ER_CANNOT_USER +create role current_role; +# this works +drop user current_user; +--error ER_PARSE_ERROR +drop user current_role; +--error ER_PARSE_ERROR +drop role current_user; +--error ER_CANNOT_USER +drop role current_role; +show warnings; + +--change_user root + +create role r1; +grant r1 to current_user; +set role r1; +select current_role(); + +--error ER_CANNOT_USER +create user current_role; +--error ER_CANNOT_USER +create role current_role; +--error ER_PARSE_ERROR +drop user current_role; +drop role current_role; + +select user,host,is_role from mysql.user; + |