List:Commits« Previous MessageNext Message »
From:gkodinov Date:November 29 2006 2:24pm
Subject:bk commit into 5.1 tree (gkodinov:1.2378)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of gkodinov. When gkodinov 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@stripped, 2006-11-29 15:24:51+01:00, gkodinov@stripped +9 -0
  Merge dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE2/mysql-5.0-opt
  into  dl145s.mysql.com:/data0/bk/team_tree_merge/MERGE2/mysql-5.1-opt
  MERGE: 1.1810.1698.198

  mysql-test/mysql-test-run.pl@stripped, 2006-11-29 15:24:45+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.30.49.14

  mysql-test/r/ps.result@stripped, 2006-11-29 15:24:46+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.56.1.25

  mysql-test/r/view_grant.result@stripped, 2006-11-29 15:24:46+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.8.1.12

  mysql-test/t/group_min_max.test@stripped, 2006-11-29 15:24:46+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.21.1.6

  mysql-test/t/ps.test@stripped, 2006-11-29 15:24:46+01:00, gkodinov@stripped +0 -1
    Auto merged
    MERGE: 1.56.1.22

  mysql-test/t/view_grant.test@stripped, 2006-11-29 15:24:46+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.8.1.11

  sql/opt_range.cc@stripped, 2006-11-29 15:24:46+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.159.1.74

  sql/sql_base.cc@stripped, 2006-11-29 15:24:47+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.235.1.122

  sql/table.cc@stripped, 2006-11-29 15:24:47+01:00, gkodinov@stripped +0 -0
    Auto merged
    MERGE: 1.160.1.79

# 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:	dl145s.mysql.com
# Root:	/data0/bk/team_tree_merge/MERGE2/mysql-5.1-opt/RESYNC

--- 1.363/sql/sql_base.cc	2006-11-28 17:14:10 +01:00
+++ 1.364/sql/sql_base.cc	2006-11-29 15:24:47 +01:00
@@ -4225,6 +4225,12 @@ find_field_in_tables(THD *thd, Item_iden
     {
       if (found == WRONG_GRANT)
 	return (Field*) 0;
+
+      /*
+        Only views fields should be marked as dependent, not an underlying
+        fields.
+      */
+      if (!table_ref->belong_to_view)
       {
         SELECT_LEX *current_sel= thd->lex->current_select;
         SELECT_LEX *last_select= table_ref->select_lex;

--- 1.257/sql/table.cc	2006-11-29 14:32:30 +01:00
+++ 1.258/sql/table.cc	2006-11-29 15:24:47 +01:00
@@ -3263,7 +3263,18 @@ bool st_table_list::prepare_view_securet
       }
       else
       {
-        my_error(ER_NO_SUCH_USER, MYF(0), definer.user.str, definer.host.str);
+        if (thd->security_ctx->master_access & SUPER_ACL)
+        {
+          my_error(ER_NO_SUCH_USER, MYF(0), definer.user.str, definer.host.str);
+
+        }
+        else
+        {
+           my_error(ER_ACCESS_DENIED_ERROR, MYF(0),
+                    thd->security_ctx->priv_user,
+                    thd->security_ctx->priv_host,
+                    (thd->password ?  ER(ER_YES) : ER(ER_NO)));
+        }
         DBUG_RETURN(TRUE);
       }
     }

--- 1.25/mysql-test/r/view_grant.result	2006-09-18 12:44:36 +02:00
+++ 1.26/mysql-test/r/view_grant.result	2006-11-29 15:24:46 +01:00
@@ -714,3 +714,23 @@ DROP FUNCTION f1;
 DROP VIEW v2;
 DROP VIEW v1;
 DROP USER mysqltest_u1@localhost;
+CREATE DATABASE db17254;
+USE db17254;
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (10),(20);
+CREATE USER def_17254@localhost;
+GRANT SELECT ON db17254.* TO def_17254@localhost;
+CREATE USER inv_17254@localhost;
+GRANT SELECT ON db17254.t1 TO inv_17254@localhost;
+GRANT CREATE VIEW ON db17254.* TO def_17254@localhost;
+CREATE VIEW v1 AS SELECT * FROM t1;
+DROP USER def_17254@localhost;
+for a user
+SELECT * FROM v1;
+ERROR 42000: SELECT command denied to user 'inv_17254'@'localhost' for table 'v1
+'
+for a superuser
+SELECT * FROM v1;
+ERROR HY000: There is no 'def_17254'@'localhost' registered
+DROP USER inv_17254@localhost;
+DROP DATABASE db17254;

--- 1.23/mysql-test/t/view_grant.test	2006-11-21 22:15:30 +01:00
+++ 1.24/mysql-test/t/view_grant.test	2006-11-29 15:24:46 +01:00
@@ -933,4 +933,41 @@ DROP VIEW v2;
 DROP VIEW v1;
 DROP USER mysqltest_u1@localhost;
 
+#
+# Bug#17254: Error for DEFINER security on VIEW provides too much info
+#
+connect (root,localhost,root,,);
+connection root;
+CREATE DATABASE db17254;
+USE db17254;
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (10),(20);
+CREATE USER def_17254@localhost;
+GRANT SELECT ON db17254.* TO def_17254@localhost;
+CREATE USER inv_17254@localhost;
+GRANT SELECT ON db17254.t1 TO inv_17254@localhost;
+GRANT CREATE VIEW ON db17254.* TO def_17254@localhost;
+
+connect (def,localhost,def_17254,,db17254);
+connection def;
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+connection root;
+DROP USER def_17254@localhost;
+
+connect (inv,localhost,inv_17254,,db17254);
+connection inv;
+--echo for a user
+--error 1142
+SELECT * FROM v1;
+
+connection root;
+--echo for a superuser
+--error 1449
+SELECT * FROM v1;
+DROP USER inv_17254@localhost;
+DROP DATABASE db17254;
+disconnect def;
+disconnect inv;
+
 # End of 5.0 tests.

--- 1.88/mysql-test/r/ps.result	2006-11-20 21:14:58 +01:00
+++ 1.89/mysql-test/r/ps.result	2006-11-29 15:24:46 +01:00
@@ -1477,6 +1477,24 @@ i
 1
 DEALLOCATE PREPARE stmt;
 DROP TABLE t1, t2;
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1), (2);
+SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i
+WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1);
+i
+1
+PREPARE stmt FROM "SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i
+WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1)";
+EXECUTE stmt;
+i
+1
+EXECUTE stmt;
+i
+1
+DEALLOCATE PREPARE stmt;
+DROP VIEW v1;
+DROP TABLE t1;
 DROP PROCEDURE IF EXISTS p1;
 flush status;
 prepare sq from 'show status like "slow_queries"';

--- 1.87/mysql-test/t/ps.test	2006-11-20 21:14:59 +01:00
+++ 1.88/mysql-test/t/ps.test	2006-11-29 15:24:46 +01:00
@@ -1515,6 +1515,29 @@ DROP TABLE t1, t2;
 
 
 #
+# BUG#20327: Marking of a wrong field leads to a wrong result on select with
+#            view, prepared statement and subquery.
+#
+CREATE TABLE t1 (i INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+INSERT INTO t1 VALUES (1), (2);
+
+let $query = SELECT t1.i FROM t1 JOIN v1 ON t1.i = v1.i
+             WHERE EXISTS (SELECT * FROM t1 WHERE v1.i = 1);
+eval $query;
+eval PREPARE stmt FROM "$query";
+# Statement execution should return '1'.
+EXECUTE stmt;
+# Check re-execution.
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+DROP VIEW v1;
+DROP TABLE t1;
+
+
+#
 # BUG#21856: Prepared Statments: crash if bad create
 #
 --disable_warnings
Thread
bk commit into 5.1 tree (gkodinov:1.2378)gkodinov29 Nov