summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-05-28 01:48:47 +0300
committerunknown <bell@sanja.is.com.ua>2003-05-28 01:48:47 +0300
commit2e3f106578def9cb8ac009bacac051a7915ca744 (patch)
treeb883d88c03c5cf2f964ee6729549baa0d19c89af /sql/sql_parse.cc
parent7f459bccbb8727363707b7d0ba6dbb8488b3e28a (diff)
parent2029fa02c330e07e9e77c765fc5d5aaa7667e3d2 (diff)
downloadmariadb-git-2e3f106578def9cb8ac009bacac051a7915ca744.tar.gz
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc54
1 files changed, 44 insertions, 10 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e6ffec7ef26..473c1dd07f6 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2285,15 +2285,23 @@ mysql_execute_command(THD *thd)
TABLE_LIST *table;
if (check_db_used(thd,tables))
goto error;
- for (table=tables ; table ; table=table->next)
+
+ if (check_access(thd,UPDATE_ACL,tables->db,&tables->grant.privilege))
+ goto error;
{
- if (table->derived)
- table->grant.privilege= SELECT_ACL;
- else if (check_access(thd,UPDATE_ACL,table->db,&table->grant.privilege))
+ // Show only 1 table for check_grant
+ TABLE_LIST *subselects_tables= tables->next;
+ tables->next= 0;
+ if (grant_option && check_grant(thd, UPDATE_ACL, tables))
+ goto error;
+ tables->next= subselects_tables;
+
+ // check rights on tables of subselect (if exists)
+ if (subselects_tables &&
+ (res= check_table_access(thd, SELECT_ACL, subselects_tables)))
goto error;
}
- if (grant_option && check_grant(thd,UPDATE_ACL,tables))
- goto error;
+
if (select_lex->item_list.elements != lex->value_list.elements)
{
send_error(thd,ER_WRONG_VALUE_COUNT);
@@ -2349,8 +2357,21 @@ mysql_execute_command(THD *thd)
INSERT_ACL | DELETE_ACL : INSERT_ACL | update);
if (check_access(thd,privilege,tables->db,&tables->grant.privilege))
goto error; /* purecov: inspected */
- if (grant_option && check_grant(thd,privilege,tables))
- goto error;
+
+ {
+ // Show only 1 table for check_grant
+ TABLE_LIST *subselects_tables= tables->next;
+ tables->next= 0;
+ if (grant_option && check_grant(thd, privilege, tables))
+ goto error;
+ tables->next= subselects_tables;
+
+ // check rights on tables of subselect (if exists)
+ if (subselects_tables &&
+ (res= check_table_access(thd, SELECT_ACL, subselects_tables)))
+ goto error;
+ }
+
if (select_lex->item_list.elements != lex->value_list.elements)
{
send_error(thd,ER_WRONG_VALUE_COUNT);
@@ -2434,8 +2455,21 @@ mysql_execute_command(THD *thd)
{
if (check_access(thd,DELETE_ACL,tables->db,&tables->grant.privilege))
goto error; /* purecov: inspected */
- if (grant_option && check_grant(thd,DELETE_ACL,tables))
- goto error;
+
+ {
+ // Show only 1 table for check_grant
+ TABLE_LIST *subselects_tables= tables->next;
+ tables->next= 0;
+ if (grant_option && check_grant(thd, DELETE_ACL, tables))
+ goto error;
+ tables->next= subselects_tables;
+
+ // check rights on tables of subselect (if exists)
+ if (subselects_tables &&
+ (res= check_table_access(thd, SELECT_ACL, subselects_tables)))
+ goto error;
+ }
+
// Set privilege for the WHERE clause
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
res = mysql_delete(thd,tables, select_lex->where,