Commit 1ccd1daa authored by Anel Husakovic's avatar Anel Husakovic

MDEV-24289: show grants missing with grant option

Reviewed by:serg@mariadb.com
parent 5991bd62
...@@ -146,3 +146,18 @@ drop role test_role2; ...@@ -146,3 +146,18 @@ drop role test_role2;
delete from mysql.roles_mapping where Role='test_role1'; delete from mysql.roles_mapping where Role='test_role1';
delete from mysql.roles_mapping where Role='test_role2'; delete from mysql.roles_mapping where Role='test_role2';
flush privileges; flush privileges;
#
# MDEV-24289: show grants missing with grant option
#
create role anel;
GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'anel';
SHOW GRANTS for 'anel';
Grants for anel
GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'anel'
create role MariaDB_admin;
GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'MariaDB_admin' WITH GRANT OPTION;
SHOW GRANTS for 'MariaDB_admin';
Grants for MariaDB_admin
GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'MariaDB_admin' WITH GRANT OPTION
drop role MariaDB_admin;
drop role anel;
...@@ -88,3 +88,16 @@ drop role test_role2; ...@@ -88,3 +88,16 @@ drop role test_role2;
delete from mysql.roles_mapping where Role='test_role1'; delete from mysql.roles_mapping where Role='test_role1';
delete from mysql.roles_mapping where Role='test_role2'; delete from mysql.roles_mapping where Role='test_role2';
flush privileges; flush privileges;
--echo #
--echo # MDEV-24289: show grants missing with grant option
--echo #
create role anel;
GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'anel';
SHOW GRANTS for 'anel';
create role MariaDB_admin;
GRANT SELECT, UPDATE, DELETE, ALTER ON *.* TO 'MariaDB_admin' WITH GRANT OPTION;
SHOW GRANTS for 'MariaDB_admin';
drop role MariaDB_admin;
drop role anel;
...@@ -8945,7 +8945,8 @@ static bool show_global_privileges(THD *thd, ACL_USER_BASE *acl_entry, ...@@ -8945,7 +8945,8 @@ static bool show_global_privileges(THD *thd, ACL_USER_BASE *acl_entry,
if (!handle_as_role) if (!handle_as_role)
add_user_parameters(&global, (ACL_USER *)acl_entry, (want_access & GRANT_ACL)); add_user_parameters(&global, (ACL_USER *)acl_entry, (want_access & GRANT_ACL));
else if (want_access & GRANT_ACL)
global.append(STRING_WITH_LEN(" WITH GRANT OPTION"));
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(global.ptr(),global.length(),global.charset()); protocol->store(global.ptr(),global.length(),global.charset());
if (protocol->write()) if (protocol->write())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment