#At file:///mnt/raid/alik/MySQL/bzr/00/bug27480/mysql-5.5-runtime-bug27480.2/ based on revid:alik@stripped
3117 Alexander Nozdrin 2010-08-20
Name TABLE_LIST instance "table_list", not "table".
modified:
sql/sql_acl.cc
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2010-07-29 12:32:11 +0000
+++ b/sql/sql_acl.cc 2010-08-20 07:34:34 +0000
@@ -4032,10 +4032,11 @@ end:
*/
-bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
+bool check_grant(THD *thd, ulong want_access, TABLE_LIST *table_list_seq,
bool any_combination_will_do, uint number, bool no_errors)
{
- TABLE_LIST *table, *first_not_own_table= thd->lex->first_not_own_table();
+ TABLE_LIST *table_list;
+ TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
Security_context *sctx= thd->security_ctx;
uint i;
ulong orig_want_access= want_access;
@@ -4052,34 +4053,33 @@ bool check_grant(THD *thd, ulong want_ac
the given table list refers to the list for prelocking (contains tables
of other queries). For simple queries first_not_own_table is 0.
*/
- for (i= 0, table= tables;
- i < number && table != first_not_own_table;
- table= table->next_global, i++)
+ for (i= 0, table_list= table_list_seq;
+ i < number && table_list != first_not_own_table;
+ table_list= table_list->next_global, i++)
{
/*
Save a copy of the privileges without the SHOW_VIEW_ACL attribute.
It will be checked during making view.
*/
- table->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL);
+ table_list->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL);
}
mysql_rwlock_rdlock(&LOCK_grant);
- for (table= tables;
- table && number-- && table != first_not_own_table;
- table= table->next_global)
- {
- GRANT_TABLE *grant_table;
- sctx = test(table->security_ctx) ?
- table->security_ctx : thd->security_ctx;
-
- const ACL_internal_table_access *access;
- access= get_cached_table_access(&table->grant.m_internal,
- table->get_db_name(),
- table->get_table_name());
+ for (table_list= table_list_seq;
+ table_list && number-- && table_list != first_not_own_table;
+ table_list= table_list->next_global)
+ {
+ sctx = test(table_list->security_ctx) ?
+ table_list->security_ctx : thd->security_ctx;
+
+ const ACL_internal_table_access *access=
+ get_cached_table_access(&table_list->grant.m_internal,
+ table_list->get_db_name(),
+ table_list->get_table_name());
if (access)
{
- switch(access->check(orig_want_access, &table->grant.privilege))
+ switch(access->check(orig_want_access, &table_list->grant.privilege))
{
case ACL_INTERNAL_ACCESS_GRANTED:
/*
@@ -4103,29 +4103,33 @@ bool check_grant(THD *thd, ulong want_ac
if (!want_access)
continue; // ok
- if (!(~table->grant.privilege & want_access) ||
- table->is_anonymous_derived_table() || table->schema_table)
+ if (!(~table_list->grant.privilege & want_access) ||
+ table_list->is_anonymous_derived_table() || table_list->schema_table)
{
/*
- It is subquery in the FROM clause. VIEW set table->derived after
+ It is subquery in the FROM clause. VIEW set table_list->derived after
table opening, but this function always called before table opening.
*/
- if (!table->referencing_view)
+ if (!table_list->referencing_view)
{
/*
If it's a temporary table created for a subquery in the FROM
clause, or an INFORMATION_SCHEMA table, drop the request for
a privilege.
*/
- table->grant.want_privilege= 0;
+ table_list->grant.want_privilege= 0;
}
continue;
}
- if (!(grant_table= table_hash_search(sctx->host, sctx->ip,
- table->get_db_name(), sctx->priv_user,
- table->get_table_name(), FALSE)))
+ GRANT_TABLE *grant_table= table_hash_search(sctx->host, sctx->ip,
+ table_list->get_db_name(),
+ sctx->priv_user,
+ table_list->get_table_name(),
+ FALSE);
+
+ if (!grant_table)
{
- want_access &= ~table->grant.privilege;
+ want_access &= ~table_list->grant.privilege;
goto err; // No grants
}
@@ -4136,18 +4140,18 @@ bool check_grant(THD *thd, ulong want_ac
if (any_combination_will_do)
continue;
- table->grant.grant_table=grant_table; // Remember for column test
- table->grant.version=grant_version;
- table->grant.privilege|= grant_table->privs;
- table->grant.want_privilege= ((want_access & COL_ACLS)
- & ~table->grant.privilege);
+ table_list->grant.grant_table= grant_table; // Remember for column test
+ table_list->grant.version= grant_version;
+ table_list->grant.privilege|= grant_table->privs;
+ table_list->grant.want_privilege= ((want_access & COL_ACLS)
+ & ~table_list->grant.privilege);
- if (!(~table->grant.privilege & want_access))
+ if (!(~table_list->grant.privilege & want_access))
continue;
- if (want_access & ~(grant_table->cols | table->grant.privilege))
+ if (want_access & ~(grant_table->cols | table_list->grant.privilege))
{
- want_access &= ~(grant_table->cols | table->grant.privilege);
+ want_access &= ~(grant_table->cols | table_list->grant.privilege);
goto err; // impossible
}
}
@@ -4164,7 +4168,7 @@ err:
command,
sctx->priv_user,
sctx->host_or_ip,
- table ? table->get_table_name() : "unknown");
+ table_list ? table_list->get_table_name() : "unknown");
}
DBUG_RETURN(TRUE);
}
Attachment: [text/bzr-bundle] bzr/alik@sun.com-20100820073434-s8tgtbn019904opk.bundle
| Thread |
|---|
| • bzr commit into mysql-5.5-bugfixing branch (alik:3117) | Alexander Nozdrin | 20 Aug |