diff options
author | unknown <gluh@mysql.com> | 2005-05-07 13:55:46 +0000 |
---|---|---|
committer | unknown <gluh@mysql.com> | 2005-05-07 13:55:46 +0000 |
commit | bd58e3e59cfa4dd03feb515b38858ba05820284c (patch) | |
tree | 14fdaabd43346891117966f8c76219034a9fc513 /sql | |
parent | 8ed5d70f6eac85e384127e0b346444e4930812d6 (diff) | |
download | mariadb-git-bd58e3e59cfa4dd03feb515b38858ba05820284c.tar.gz |
Fix for bug #9838: INFORMATION_SCHEMA.COLUMNS columns of granted views missing
sql/sql_acl.cc:
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
sql/sql_show.cc:
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).
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_acl.cc | 10 | ||||
-rw-r--r-- | sql/sql_show.cc | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index c0bbc4d481a..ca9ba7611e6 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -63,8 +63,7 @@ static bool allow_all_hosts=1; 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 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) 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 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list, 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 @@ ulong get_column_grant(THD *thd, GRANT_INFO *grant, 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; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index f48a8d67d54..ceb98740298 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2303,8 +2303,8 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables, 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; |