Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5.12
-
None
Description
The error message for SET DEFAULT ROLE refers to the user performing the operation instead of the target user. This is misleading as the user giving the grant doesn't require the grant itself, only the target user.
Here's an example (and a test case) that reproduces the problem:
MariaDB [test]> create role test_role;
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [test]> create user test_user;
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [test]> set default role test_role for test_user;
|
ERROR 1959 (OP000): User `maxuser`@`127.0.0.1` has not been granted role `test_role`
|
MariaDB [test]> grant test_role to maxuser@127.0.0.1;
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [test]> set default role test_role for test_user;
|
ERROR 1959 (OP000): User `maxuser`@`127.0.0.1` has not been granted role `test_role`
|
MariaDB [test]> grant test_role to test_user;
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [test]> set default role test_role for test_user;
|
Query OK, 0 rows affected (0.000 sec)
|
Attachments
Issue Links
- duplicates
-
MDEV-27478 Misleading error message for SET DEFAULT ROLE
-
- Closed
-
- relates to
-
MDEV-22312 Bad error message for SET DEFAULT ROLE when user account is not granted the role
-
- Closed
-
-
MDEV-26081 set role crashes when a hostname cannot be resolved
-
- Closed
-
-
MDEV-6967 Wrong error code/message ER_INVALID_ROLE on setting a default role for non-existing user
-
- Open
-
- links to
I mean that thd->security_ctx->priv_user corresponds to thd->security_ctx->priv_host, there is a row in the mysql.user where username is thd->security_ctx->priv_user and hostname is thd->security_ctx->priv_host.
While user corresponds to host. They were both specified in the command SET DEFAULT ROLE FOR.
A pair or user and thd->security_ctx->priv_host is a wrong combination, it does not necessarily correspond to anything in particular.