summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorgkodinov@mysql.com <>2006-06-21 12:12:46 +0300
committergkodinov@mysql.com <>2006-06-21 12:12:46 +0300
commit75ca0554935b4e70394618da3de956fc27e894cf (patch)
tree4d1eaabc3133949024515c0746b67bb1c08977bd /sql/sql_parse.cc
parentee2e2d0c6d46d0d58e4bcff0b4c8289882e254b4 (diff)
downloadmariadb-git-75ca0554935b4e70394618da3de956fc27e894cf.tar.gz
Bug #20482: failure on Create join view with sources views/tables in different
schemas The function check_one_table_access() called to check access to tables in SELECT/INSERT/UPDATE was doing additional checks/modifications that don't hold in the context of setup_tables_and_check_access(). That's why the check_one_table() was split into two : the functionality needed by setup_tables_and_check_access() into check_single_table_access() and the rest of the functionality stays in check_one_table_access() that is made to call the new check_single_table_access() function.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc40
1 files changed, 31 insertions, 9 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 37e45e999b3..6ec8bd65a90 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -4978,11 +4978,10 @@ error:
/*
- Check grants for commands which work only with one table and all other
- tables belonging to subselects or implicitly opened tables.
+ Check grants for commands which work only with one table.
SYNOPSIS
- check_one_table_access()
+ check_single_table_access()
thd Thread handler
privilege requested privilege
all_tables global table list of query
@@ -4992,7 +4991,8 @@ error:
1 - access denied, error is sent to client
*/
-bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
+bool check_single_table_access(THD *thd, ulong privilege,
+ TABLE_LIST *all_tables)
{
Security_context * backup_ctx= thd->security_ctx;
@@ -5010,19 +5010,41 @@ bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
goto deny;
thd->security_ctx= backup_ctx;
+ return 0;
+
+deny:
+ thd->security_ctx= backup_ctx;
+ return 1;
+}
+
+/*
+ Check grants for commands which work only with one table and all other
+ tables belonging to subselects or implicitly opened tables.
+
+ SYNOPSIS
+ check_one_table_access()
+ thd Thread handler
+ privilege requested privilege
+ all_tables global table list of query
+
+ RETURN
+ 0 - OK
+ 1 - access denied, error is sent to client
+*/
+
+bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
+{
+ if (check_single_table_access (thd,privilege,all_tables))
+ return 1;
/* Check rights on tables of subselects and implictly opened tables */
TABLE_LIST *subselects_tables;
if ((subselects_tables= all_tables->next_global))
{
if ((check_table_access(thd, SELECT_ACL, subselects_tables, 0)))
- goto deny;
+ return 1;
}
return 0;
-
-deny:
- thd->security_ctx= backup_ctx;
- return 1;
}