[MDEV-5228] Incorrect message test on a failed attempt to revoke grants from a role Created: 2013-11-02  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Authentication and Privilege System
Affects Version/s: 10.0.10, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Trivial
Reporter: Elena Stepanova Assignee: Vicențiu Ciorbaru
Resolution: Unresolved Votes: 0
Labels: beginner-friendly

Issue Links:
Relates
relates to MDEV-4397 Roles Closed
relates to MDEV-5164 Testing Roles Closed

 Description   

The message incorrectly identifies the entity as a user, while it is a role:

MariaDB [test]> create role foo;
Query OK, 0 rows affected (0.01 sec)
 
MariaDB [test]> revoke all on bar.* from foo;
ERROR 1141 (42000): There is no such grant defined for user 'foo' on host ''

Since other errors seem to be able to distinguish between a user and a role, it might make sense fix this one too.



 Comments   
Comment by Igor Pashev [ 2016-03-20 ]

REVOKE ALL, GRANT OPTION FROM <role>; also fails if the <role> has no privileges granted.

Comment by Igor Pashev [ 2016-03-20 ]

It's even more complicated:

MariaDB [mysql]> create role role1;
Query OK, 0 rows affected (0.01 sec)
 
MariaDB [mysql]> grant select on mysql.user to role1;
Query OK, 0 rows affected (0.01 sec)
 
MariaDB [mysql]> create role role2;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [mysql]> grant role1 to role2;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [mysql]> revoke all, grant option from role2;
ERROR 1147 (42000): There is no such grant defined for user 'role2' on host '' on table 'user'
Error (Code 1147): There is no such grant defined for user 'role2' on host '' on table 'user'
Error (Code 1269): Can't revoke all privileges for one or more of the requested users
MariaDB [mysql]> show grants for role2;
+-------------------------------+
| Grants for role2              |
+-------------------------------+
| GRANT USAGE ON *.* TO 'role2' |
+-------------------------------+

Generated at Thu Feb 08 07:02:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.