diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2016-05-02 12:58:57 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2016-05-02 12:58:57 +0400 |
commit | 94cd0f6c9b3b04db67501ef29d470f32527ceda2 (patch) | |
tree | fa3fd3226ee2b10ba2c926c1845fb1a0d012142f /mysql-test/suite/roles | |
parent | ad4239cc3dc7ad5f6f264e1fb3cf6d24084bda90 (diff) | |
download | mariadb-git-94cd0f6c9b3b04db67501ef29d470f32527ceda2.tar.gz |
MDEV-9898 SET ROLE NONE can crash mysqld.
The check_user_can_set_role() used find_user_exact() to get the
permissions for the SET ROLE NONE command. Which returned NULL too often,
for instance when user authenticated as 'user'@'%'.
Now we use find_user_wild() instead.
Diffstat (limited to 'mysql-test/suite/roles')
-rw-r--r-- | mysql-test/suite/roles/set_role-simple.result | 9 | ||||
-rw-r--r-- | mysql-test/suite/roles/set_role-simple.test | 15 |
2 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/suite/roles/set_role-simple.result b/mysql-test/suite/roles/set_role-simple.result index 3ce6d5c054b..4fb705368b7 100644 --- a/mysql-test/suite/roles/set_role-simple.result +++ b/mysql-test/suite/roles/set_role-simple.result @@ -45,3 +45,12 @@ delete from mysql.user where user='test_role1'; delete from mysql.roles_mapping where Role='test_role1'; flush privileges; drop user 'test_user'@'localhost'; +create user user1; +select current_user; +current_user +user1@% +show grants; +Grants for user1@% +GRANT USAGE ON *.* TO 'user1'@'%' +set role none; +drop user user1; diff --git a/mysql-test/suite/roles/set_role-simple.test b/mysql-test/suite/roles/set_role-simple.test index 152a1d0eb25..ed884fa2407 100644 --- a/mysql-test/suite/roles/set_role-simple.test +++ b/mysql-test/suite/roles/set_role-simple.test @@ -37,3 +37,18 @@ delete from mysql.user where user='test_role1'; delete from mysql.roles_mapping where Role='test_role1'; flush privileges; drop user 'test_user'@'localhost'; + +# +# MDEV-9898 SET ROLE NONE can crash mysqld. +# + +create user user1; + +--connect (con1,localhost,user1,,) +select current_user; +show grants; +set role none; + +connection default; +drop user user1; + |