MDEV-23010 UPDATE privilege at Database and Table level fail to update with SELECT command denied to user
check both column- and table-level grants when looking for SELECT privilege on UPDATE statement.
This commit is contained in:
parent
2ba70f69fd
commit
e54a7ac1b3
@ -23,3 +23,13 @@ ERROR HY000: Table 'user' was not locked with LOCK TABLES
|
||||
REVOKE PROCESS ON *.* FROM u;
|
||||
ERROR HY000: Table 'user' was not locked with LOCK TABLES
|
||||
DROP TABLE t1;
|
||||
create database mysqltest1;
|
||||
use mysqltest1;
|
||||
create table t1(id int);
|
||||
insert t1 values(2);
|
||||
create user u1@localhost;
|
||||
grant select on mysqltest1.t1 to u1@localhost;
|
||||
grant update on mysqltest1.* to u1@localhost;
|
||||
update mysqltest1.t1 set id=1 where id=2;
|
||||
drop user u1@localhost;
|
||||
drop database mysqltest1;
|
||||
|
@ -20,6 +20,7 @@ show grants for foo; # role
|
||||
--error ER_DBACCESS_DENIED_ERROR
|
||||
show grants for foo@'%'; # user
|
||||
--connection default
|
||||
--disconnect conn_1
|
||||
drop user test, foo;
|
||||
drop role foo;
|
||||
|
||||
@ -33,3 +34,24 @@ REVOKE EXECUTE ON PROCEDURE sp FROM u;
|
||||
--error ER_TABLE_NOT_LOCKED
|
||||
REVOKE PROCESS ON *.* FROM u;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# MDEV-23010 UPDATE privilege at Database and Table level fail to update with SELECT command denied to user
|
||||
#
|
||||
create database mysqltest1;
|
||||
use mysqltest1;
|
||||
create table t1(id int);
|
||||
insert t1 values(2);
|
||||
create user u1@localhost;
|
||||
grant select on mysqltest1.t1 to u1@localhost;
|
||||
grant update on mysqltest1.* to u1@localhost;
|
||||
connect u1, localhost, u1;
|
||||
update mysqltest1.t1 set id=1 where id=2;
|
||||
connection default;
|
||||
disconnect u1;
|
||||
drop user u1@localhost;
|
||||
drop database mysqltest1;
|
||||
|
||||
#
|
||||
# End of 10.1 tests
|
||||
#
|
||||
|
@ -7135,9 +7135,13 @@ static void check_grant_column_int(GRANT_TABLE *grant_table, const char *name,
|
||||
{
|
||||
if (grant_table)
|
||||
{
|
||||
GRANT_COLUMN *grant_column= column_hash_search(grant_table, name, length);
|
||||
if (grant_column)
|
||||
*want_access&= ~grant_column->rights;
|
||||
*want_access&= ~grant_table->privs;
|
||||
if (*want_access & grant_table->cols)
|
||||
{
|
||||
GRANT_COLUMN *grant_column= column_hash_search(grant_table, name, length);
|
||||
if (grant_column)
|
||||
*want_access&= ~grant_column->rights;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user