Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1936 05/05/07 13:55:46 gluh@stripped +4 -0
Fix for bug #9838: INFORMATION_SCHEMA.COLUMNS columns of granted views missing
sql/sql_show.cc
1.241 05/05/07 13:55:41 gluh@stripped +2 -2
Fix for bug #9838: INFORMATION_SCHEMA.COLUMNS columns of granted views missing
use 'base_name', 'file_name' because 'tables->db', 'tables->tables' could
be invalid in
case of view(derived tables).
sql/sql_acl.cc
1.150 05/05/07 13:55:41 gluh@stripped +5 -5
Fix for bug #9838: INFORMATION_SCHEMA.COLUMNS columns of granted views missing
-increase grant_version in acl_init, mysql_table_grant
-table privileges should be taken into account when we calculate column
grants
mysql-test/t/information_schema.test
1.34 05/05/07 13:55:41 gluh@stripped +14 -5
Fix for bug #9838: INFORMATION_SCHEMA.COLUMNS columns of granted views missing
mysql-test/r/information_schema.result
1.48 05/05/07 13:55:41 gluh@stripped +13 -5
Fix for bug #9838: INFORMATION_SCHEMA.COLUMNS columns of granted views missing
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gluh
# Host: mobby.(none)
# Root: /home/gluh/MySQL/Bugs/5.0.9838
--- 1.149/sql/sql_acl.cc 2005-05-06 10:46:05 +00:00
+++ 1.150/sql/sql_acl.cc 2005-05-07 13:55:41 +00:00
@@ -63,8 +63,7 @@
static HASH acl_check_hosts, column_priv_hash, proc_priv_hash;
static DYNAMIC_ARRAY acl_wild_hosts;
static hash_filo *acl_cache;
-static uint grant_version=0;
-static uint priv_version=0; /* Version of priv tables. incremented by acl_init */
+static uint grant_version=0; /* Version of priv tables. incremented by acl_init */
static ulong get_access(TABLE *form,uint fieldnr, uint *next_field=0);
static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b);
static ulong get_sort(uint count,...);
@@ -153,7 +152,7 @@
DBUG_RETURN(0); /* purecov: tested */
}
- priv_version++; /* Privileges updated */
+ grant_version++; /* Privileges updated */
mysql_proc_table_exists= 1; // Assume mysql.proc exists
/*
@@ -2721,6 +2720,7 @@
rw_wrlock(&LOCK_grant);
MEM_ROOT *old_root= thd->mem_root;
thd->mem_root= &memex;
+ grant_version++;
while ((Str = str_list++))
{
@@ -3689,9 +3689,9 @@
grant_column= column_hash_search(grant_table, field_name,
(uint) strlen(field_name));
if (!grant_column)
- priv= grant->privilege;
+ priv= (grant->privilege | grant_table->privs);
else
- priv= grant->privilege | grant_column->rights;
+ priv= (grant->privilege | grant_table->privs | grant_column->rights);
}
rw_unlock(&LOCK_grant);
return priv;
--- 1.240/sql/sql_show.cc 2005-05-06 16:43:52 +00:00
+++ 1.241/sql/sql_show.cc 2005-05-07 13:55:41 +00:00
@@ -2303,8 +2303,8 @@
uint col_access;
check_access(thd,SELECT_ACL | EXTRA_ACL, base_name,
&tables->grant.privilege, 0, 0);
- col_access= get_column_grant(thd, &tables->grant, tables->db,
- tables->table_name,
+ col_access= get_column_grant(thd, &tables->grant,
+ base_name, file_name,
field->field_name) & COL_ACLS;
if (lex->orig_sql_command != SQLCOM_SHOW_FIELDS && !col_access)
continue;
--- 1.47/mysql-test/r/information_schema.result 2005-05-06 20:14:16 +00:00
+++ 1.48/mysql-test/r/information_schema.result 2005-05-07 13:55:41 +00:00
@@ -3,6 +3,8 @@
skip_show_database OFF
grant select, update, execute on test.* to mysqltest_2@localhost;
grant select, update on test.* to mysqltest_1@localhost;
+create user mysqltest_3@localhost;
+create user mysqltest_3;
select * from information_schema.SCHEMATA where schema_name > 'm';
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
NULL mysql latin1 latin1_swedish_ci NULL
@@ -154,7 +156,9 @@
show columns from mysqltest.t1 where field like "%a%";
Field Type Null Key Default Extra
a int(11) YES NULL
+create view mysqltest.v1 (c) as select a from mysqltest.t1;
grant select (a) on mysqltest.t1 to mysqltest_2@localhost;
+grant select on mysqltest.v1 to mysqltest_3;
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 't1';
table_name column_name privileges
@@ -163,7 +167,11 @@
Field Type Null Key Default Extra
a int(11) YES NULL
b varchar(30) YES MUL NULL
-drop view v1;
+select table_name, column_name, privileges from information_schema.columns
+where table_schema = 'mysqltest' and table_name = 'v1';
+table_name column_name privileges
+v1 c select
+drop view v1, mysqltest.v1;
drop tables mysqltest.t4, mysqltest.t1, t2, t3;
drop database mysqltest;
select * from information_schema.CHARACTER_SETS
@@ -376,10 +384,10 @@
'mysqltest_1'@'localhost' NULL test t1 a INSERT NO
'mysqltest_1'@'localhost' NULL test t1 a UPDATE NO
'mysqltest_1'@'localhost' NULL test t1 a REFERENCES NO
-delete from mysql.user where user='mysqltest_1' or user='mysqltest_2';
-delete from mysql.db where user='mysqltest_1' or user='mysqltest_2';
-delete from mysql.tables_priv where user='mysqltest_1' or user='mysqltest_2';
-delete from mysql.columns_priv where user='mysqltest_1' or user='mysqltest_2';
+delete from mysql.user where user like 'mysqltest%';
+delete from mysql.db where user like 'mysqltest%';
+delete from mysql.tables_priv where user like 'mysqltest%';
+delete from mysql.columns_priv where user like 'mysqltest%';
flush privileges;
drop table t1;
create table t1 (a int null, primary key(a));
--- 1.33/mysql-test/t/information_schema.test 2005-04-14 06:03:09 +00:00
+++ 1.34/mysql-test/t/information_schema.test 2005-05-07 13:55:41 +00:00
@@ -7,6 +7,9 @@
show variables where variable_name like "skip_show_database";
grant select, update, execute on test.* to mysqltest_2@localhost;
grant select, update on test.* to mysqltest_1@localhost;
+create user mysqltest_3@localhost;
+create user mysqltest_3;
+
select * from information_schema.SCHEMATA where schema_name > 'm';
select schema_name from information_schema.schemata;
@@ -53,15 +56,21 @@
and column_name= "a";
show columns from mysqltest.t1 where field like "%a%";
+create view mysqltest.v1 (c) as select a from mysqltest.t1;
grant select (a) on mysqltest.t1 to mysqltest_2@localhost;
+grant select on mysqltest.v1 to mysqltest_3;
connect (user3,localhost,mysqltest_2,,);
connection user3;
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 't1';
show columns from mysqltest.t1;
+connect (user4,localhost,mysqltest_3,,mysqltest);
+connection user4;
+select table_name, column_name, privileges from information_schema.columns
+where table_schema = 'mysqltest' and table_name = 'v1';
connection default;
-drop view v1;
+drop view v1, mysqltest.v1;
drop tables mysqltest.t4, mysqltest.t1, t2, t3;
drop database mysqltest;
@@ -176,10 +185,10 @@
select * from information_schema.SCHEMA_PRIVILEGES where grantee like '%mysqltest_1%';
select * from information_schema.TABLE_PRIVILEGES where grantee like '%mysqltest_1%';
select * from information_schema.COLUMN_PRIVILEGES where grantee like '%mysqltest_1%';
-delete from mysql.user where user='mysqltest_1' or user='mysqltest_2';
-delete from mysql.db where user='mysqltest_1' or user='mysqltest_2';
-delete from mysql.tables_priv where user='mysqltest_1' or user='mysqltest_2';
-delete from mysql.columns_priv where user='mysqltest_1' or user='mysqltest_2';
+delete from mysql.user where user like 'mysqltest%';
+delete from mysql.db where user like 'mysqltest%';
+delete from mysql.tables_priv where user like 'mysqltest%';
+delete from mysql.columns_priv where user like 'mysqltest%';
flush privileges;
drop table t1;
| Thread |
|---|
| • bk commit into 5.0 tree (gluh:1.1936) BUG#9838 | gluh | 7 May |