Commit 32880072 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

fixed db/user privileges getting (BUG#5976)

parent 7f896917
...@@ -1628,3 +1628,10 @@ Field 3,'Field 4| ...@@ -1628,3 +1628,10 @@ Field 3,'Field 4|
|Field 6| | 'Field 7'| |Field 6| | 'Field 7'|
drop view v1; drop view v1;
drop table t1; drop table t1;
create database mysqltest;
create table mysqltest.t1 (a int);
grant all privileges on mysqltest.* to mysqltest_1@localhost;
use mysqltest;
create view v1 as select * from t1;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
drop database mysqltest;
...@@ -1554,3 +1554,21 @@ select concat('|',a,'|'), concat('|',b,'|') from v1; ...@@ -1554,3 +1554,21 @@ select concat('|',a,'|'), concat('|',b,'|') from v1;
drop view v1; drop view v1;
drop table t1; drop table t1;
#
# user with global DB privileges
#
connection root;
--disable_warnings
create database mysqltest;
--enable_warnings
create table mysqltest.t1 (a int);
grant all privileges on mysqltest.* to mysqltest_1@localhost;
connection user1;
use mysqltest;
create view v1 as select * from t1;
connection root;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
drop database mysqltest;
...@@ -3889,12 +3889,13 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, ...@@ -3889,12 +3889,13 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
/* global privileges */ /* global privileges */
grant->privilege= thd->master_access; grant->privilege= thd->master_access;
/* db privileges */
grant->privilege|= acl_get(thd->host, thd->ip, thd->priv_user, db, 0);
/* if privileges ignored (--skip-grant-tables) above is enough */ /* if privileges ignored (--skip-grant-tables) above is enough */
if (!grant_option) if (!grant_option)
return; return;
/* db privileges */
grant->privilege|= acl_get(thd->host, thd->ip, thd->priv_user, db, 0);
/* table privileges */ /* table privileges */
if (grant->version != grant_version) if (grant->version != grant_version)
{ {
......
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