Skip to content

Commit 5742c36

Browse files
Bug#33578113: DROP privilege on performance_schema.* can't be revoked
Description: Just like GRANT on PFS and tables within it is allowed, REVOKE should be allowed too. Fix: Updated PFS_internal_schema_access::check() to allow privilege checks to proceed as usual for SQLCOM_REVOKE when privilege in question is DROP_ACL. RB: 27429
1 parent 4d24938 commit 5742c36

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

mysql-test/r/grant.result

+7
Original file line numberDiff line numberDiff line change
@@ -3021,3 +3021,10 @@ proxy_native_0123456789 user_name_len_32_012345678901234 user_name_len_22_01234@
30213021
DROP USER user_name_len_22_01234@localhost;
30223022
DROP USER user_name_len_32_012345678901234@localhost;
30233023
DROP USER proxy_native_0123456789@localhost;
3024+
#
3025+
# Bug#33578113: DROP privilege on performance_schema.* can't be revoked
3026+
#
3027+
CREATE USER bug33578113;
3028+
GRANT DROP ON performance_schema.* TO bug33578113;
3029+
REVOKE DROP ON performance_schema.* FROM bug33578113;
3030+
DROP USER bug33578113;

mysql-test/t/grant.test

+12
Original file line numberDiff line numberDiff line change
@@ -2743,5 +2743,17 @@ DROP USER user_name_len_22_01234@localhost;
27432743
DROP USER user_name_len_32_012345678901234@localhost;
27442744
DROP USER proxy_native_0123456789@localhost;
27452745

2746+
--echo #
2747+
--echo # Bug#33578113: DROP privilege on performance_schema.* can't be revoked
2748+
--echo #
2749+
2750+
connection default;
2751+
CREATE USER bug33578113;
2752+
2753+
GRANT DROP ON performance_schema.* TO bug33578113;
2754+
REVOKE DROP ON performance_schema.* FROM bug33578113;
2755+
2756+
DROP USER bug33578113;
2757+
27462758
# Wait till we reached the initial number of concurrent sessions
27472759
--source include/wait_until_count_sessions.inc

storage/perfschema/pfs_engine_table.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,8 @@ static bool allow_drop_table_privilege() {
862862

863863
assert(thd->lex != NULL);
864864
if ((thd->lex->sql_command != SQLCOM_TRUNCATE) &&
865-
(thd->lex->sql_command != SQLCOM_GRANT)) {
865+
(thd->lex->sql_command != SQLCOM_GRANT) &&
866+
(thd->lex->sql_command != SQLCOM_REVOKE)) {
866867
return false;
867868
}
868869

0 commit comments

Comments
 (0)