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.2171 06/06/21 12:12:46 gkodinov@stripped +5 -0
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.
sql/sql_parse.cc
1.548 06/06/21 12:12:40 gkodinov@stripped +31 -9
Bug #20482: failure on Create join view with sources views/tables in different
schemas
- check_one_table_access() split into two : check_single_table_access() to
actually check access to the table(ro) and check_one_table_access() that calls
check_single_table_access() and checks also the tables belonging to sub selects
or implicitly opened tables.
sql/sql_base.cc
1.340 06/06/21 12:12:40 gkodinov@stripped +1 -1
Bug #20482: failure on Create join view with sources views/tables in different
schemas
- the new sub-function called
sql/mysql_priv.h
1.394 06/06/21 12:12:40 gkodinov@stripped +2 -0
Bug #20482: failure on Create join view with sources views/tables in different
schemas
- check_one_table_access split into 2
mysql-test/t/view_grant.test
1.14 06/06/21 12:12:40 gkodinov@stripped +21 -0
Bug #20482: failure on Create join view with sources views/tables in different
schemas
- test suite for the bug
mysql-test/r/view_grant.result
1.16 06/06/21 12:12:40 gkodinov@stripped +12 -0
Bug #20482: failure on Create join view with sources views/tables in different
schemas
- test suite for the bug
# 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/B20482
--- 1.393/sql/mysql_priv.h 2006-05-26 11:51:14 +03:00
+++ 1.394/sql/mysql_priv.h 2006-06-21 12:12:40 +03:00
@@ -513,6 +513,8 @@
void close_thread_tables(THD *thd, bool locked=0, bool skip_derived=0);
bool check_one_table_access(THD *thd, ulong privilege,
TABLE_LIST *tables);
+bool check_single_table_access(THD *thd, ulong privilege,
+ TABLE_LIST *tables);
bool check_routine_access(THD *thd,ulong want_access,char *db,char *name,
bool is_proc, bool no_errors);
bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table);
--- 1.339/sql/sql_base.cc 2006-06-08 13:33:58 +03:00
+++ 1.340/sql/sql_base.cc 2006-06-21 12:12:40 +03:00
@@ -4545,7 +4545,7 @@
for (; leaves_tmp; leaves_tmp= leaves_tmp->next_leaf)
if (leaves_tmp->belong_to_view &&
- check_one_table_access(thd, want_access, leaves_tmp))
+ check_single_table_access(thd, want_access, leaves_tmp))
{
tables->hide_view_error(thd);
return TRUE;
--- 1.547/sql/sql_parse.cc 2006-05-29 18:07:33 +03:00
+++ 1.548/sql/sql_parse.cc 2006-06-21 12:12:40 +03:00
@@ -4978,11 +4978,10 @@
/*
- 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 @@
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 @@
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;
}
--- 1.15/mysql-test/r/view_grant.result 2006-05-26 11:57:52 +03:00
+++ 1.16/mysql-test/r/view_grant.result 2006-06-21 12:12:40 +03:00
@@ -618,3 +618,15 @@
DROP VIEW v;
DROP TABLE t1;
USE test;
+CREATE DATABASE test1;
+CREATE DATABASE test2;
+CREATE TABLE test1.t0 (a VARCHAR(20));
+CREATE TABLE test2.t1 (a VARCHAR(20));
+CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
+CREATE OR REPLACE VIEW test.v1 AS
+SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
+DROP VIEW test.v1;
+DROP VIEW test2.t3;
+DROP TABLE test2.t1, test1.t0;
+DROP DATABASE test2;
+DROP DATABASE test1;
--- 1.13/mysql-test/t/view_grant.test 2006-05-26 11:57:52 +03:00
+++ 1.14/mysql-test/t/view_grant.test 2006-06-21 12:12:40 +03:00
@@ -807,3 +807,24 @@
DROP VIEW v;
DROP TABLE t1;
USE test;
+
+#
+# BUG#20482: failure on Create join view with sources views/tables
+# in different schemas
+#
+--disable_warnings
+CREATE DATABASE test1;
+CREATE DATABASE test2;
+--enable_warnings
+
+CREATE TABLE test1.t0 (a VARCHAR(20));
+CREATE TABLE test2.t1 (a VARCHAR(20));
+CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
+CREATE OR REPLACE VIEW test.v1 AS
+ SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
+
+DROP VIEW test.v1;
+DROP VIEW test2.t3;
+DROP TABLE test2.t1, test1.t0;
+DROP DATABASE test2;
+DROP DATABASE test1;
| Thread |
|---|
| • bk commit into 5.0 tree (gkodinov:1.2171) BUG#20482 | kgeorge | 21 Jun |