Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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.2148 06/05/26 11:51:30 gkodinov@stripped +5 -0
Merge mysql.com:/home/kgeorge/mysql/5.0/clean
into mysql.com:/home/kgeorge/mysql/5.0/B18681
sql/sql_select.cc
1.421 06/05/26 11:51:17 gkodinov@stripped +0 -0
Auto merged
sql/sql_insert.cc
1.190 06/05/26 11:51:16 gkodinov@stripped +0 -0
Auto merged
sql/sql_base.cc
1.338 06/05/26 11:51:15 gkodinov@stripped +0 -0
Auto merged
sql/sql_acl.cc
1.194 06/05/26 11:51:15 gkodinov@stripped +0 -0
Auto merged
sql/mysql_priv.h
1.393 06/05/26 11:51:14 gkodinov@stripped +0 -0
Auto merged
# 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: gkodinov
# Host: rakia.(none)
# Root: /home/kgeorge/mysql/5.0/B18681/RESYNC
--- 1.392/sql/mysql_priv.h 2006-05-24 17:21:32 +03:00
+++ 1.393/sql/mysql_priv.h 2006-05-26 11:51:14 +03:00
@@ -947,6 +947,13 @@
bool setup_tables(THD *thd, Name_resolution_context *context,
List<TABLE_LIST> *from_clause, TABLE_LIST *tables,
Item **conds, TABLE_LIST **leaves, bool select_insert);
+bool setup_tables_and_check_access (THD *thd,
+ Name_resolution_context *context,
+ List<TABLE_LIST> *from_clause,
+ TABLE_LIST *tables, Item **conds,
+ TABLE_LIST **leaves,
+ bool select_insert,
+ ulong want_access);
int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
List<Item> *sum_func_list, uint wild_num);
bool setup_fields(THD *thd, Item** ref_pointer_array,
--- 1.193/sql/sql_acl.cc 2006-05-15 13:36:42 +03:00
+++ 1.194/sql/sql_acl.cc 2006-05-26 11:51:15 +03:00
@@ -3562,6 +3562,7 @@
TABLE_LIST *table, *first_not_own_table= thd->lex->first_not_own_table();
Security_context *sctx= thd->security_ctx;
uint i;
+ ulong orig_want_access= want_access;
DBUG_ENTER("check_grant");
DBUG_ASSERT(number > 0);
@@ -3583,18 +3584,22 @@
table->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL);
}
- want_access&= ~sctx->master_access;
- if (!want_access)
- DBUG_RETURN(0); // ok
-
rw_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;
+
+ want_access= orig_want_access;
+ want_access&= ~sctx->master_access;
+ if (!want_access)
+ continue; // ok
+
if (!(~table->grant.privilege & want_access) ||
- table->derived || table->schema_table || table->belong_to_view)
+ table->derived || table->schema_table)
{
/*
It is subquery in the FROM clause. VIEW set table->derived after
--- 1.337/sql/sql_base.cc 2006-05-24 17:21:32 +03:00
+++ 1.338/sql/sql_base.cc 2006-05-26 11:51:15 +03:00
@@ -4504,6 +4504,58 @@
/*
+ prepare tables and check access for the view tables
+
+ SYNOPSIS
+ setup_tables_and_check_view_access()
+ thd Thread handler
+ context name resolution contest to setup table list there
+ from_clause Top-level list of table references in the FROM clause
+ tables Table list (select_lex->table_list)
+ conds Condition of current SELECT (can be changed by VIEW)
+ leaves List of join table leaves list (select_lex->leaf_tables)
+ refresh It is onle refresh for subquery
+ select_insert It is SELECT ... INSERT command
+ want_access what access is needed
+
+ NOTE
+ a wrapper for check_tables that will also check the resulting
+ table leaves list for access to all the tables that belong to a view
+
+ RETURN
+ FALSE ok; In this case *map will include the chosen index
+ TRUE error
+*/
+bool setup_tables_and_check_access(THD *thd,
+ Name_resolution_context *context,
+ List<TABLE_LIST> *from_clause,
+ TABLE_LIST *tables,
+ Item **conds, TABLE_LIST **leaves,
+ bool select_insert,
+ ulong want_access)
+{
+ TABLE_LIST *leaves_tmp = NULL;
+
+ if (setup_tables (thd, context, from_clause, tables, conds,
+ &leaves_tmp, select_insert))
+ return TRUE;
+
+ if (leaves)
+ *leaves = leaves_tmp;
+
+ for (; leaves_tmp; leaves_tmp= leaves_tmp->next_leaf)
+ if (leaves_tmp->belong_to_view &&
+ check_one_table_access(thd, want_access, leaves_tmp))
+ {
+ tables->hide_view_error(thd);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+/*
Create a key_map from a list of index names
SYNOPSIS
--- 1.189/sql/sql_insert.cc 2006-05-24 11:56:55 +03:00
+++ 1.190/sql/sql_insert.cc 2006-05-26 11:51:16 +03:00
@@ -743,10 +743,11 @@
bool insert_into_view= (table_list->view != 0);
DBUG_ENTER("mysql_prepare_insert_check_table");
- if (setup_tables(thd, &thd->lex->select_lex.context,
- &thd->lex->select_lex.top_join_list,
- table_list, where, &thd->lex->select_lex.leaf_tables,
- select_insert))
+ if (setup_tables_and_check_access(thd, &thd->lex->select_lex.context,
+ &thd->lex->select_lex.top_join_list,
+ table_list, where,
+ &thd->lex->select_lex.leaf_tables,
+ select_insert, INSERT_ACL))
DBUG_RETURN(TRUE);
if (insert_into_view && !fields.elements)
--- 1.420/sql/sql_select.cc 2006-05-24 11:56:55 +03:00
+++ 1.421/sql/sql_select.cc 2006-05-26 11:51:17 +03:00
@@ -337,9 +337,10 @@
/* Check that all tables, fields, conds and order are ok */
if ((!(select_options & OPTION_SETUP_TABLES_DONE) &&
- setup_tables(thd, &select_lex->context, join_list,
- tables_list, &conds, &select_lex->leaf_tables,
- FALSE)) ||
+ setup_tables_and_check_access(thd, &select_lex->context, join_list,
+ tables_list, &conds,
+ &select_lex->leaf_tables, FALSE,
+ SELECT_ACL)) ||
setup_wild(thd, tables_list, fields_list, &all_fields, wild_num) ||
select_lex->setup_ref_array(thd, og_num) ||
setup_fields(thd, (*rref_pointer_array), fields_list, 1,
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2148) | kgeorge | 26 May |