List:Commits« Previous MessageNext Message »
From:kgeorge Date:May 26 2006 10:58am
Subject:bk commit into 5.0 tree (gkodinov:1.2149)
View as plain text  
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.2149 06/05/26 11:57:56 gkodinov@stripped +4 -0
  Merge mysql.com:/home/kgeorge/mysql/5.0/clean
  into  mysql.com:/home/kgeorge/mysql/5.0/B18681

  mysql-test/t/view_grant.test
    1.13 06/05/26 11:57:52 gkodinov@stripped +14 -14
    resolved merge conflict

  mysql-test/r/view_grant.result
    1.15 06/05/26 11:57:52 gkodinov@stripped +15 -15
    resolved conflict

  sql/table.cc
    1.220 06/05/26 11:54:23 gkodinov@stripped +0 -0
    Auto merged

  sql/sql_acl.cc
    1.195 06/05/26 11:54:23 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.194/sql/sql_acl.cc	2006-05-26 11:49:34 +03:00
+++ 1.195/sql/sql_acl.cc	2006-05-26 11:54:23 +03:00
@@ -3564,6 +3564,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);
 
@@ -3585,18 +3586,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.219/sql/table.cc	2006-05-26 11:47:47 +03:00
+++ 1.220/sql/table.cc	2006-05-26 11:54:23 +03:00
@@ -2429,8 +2429,18 @@
                                 definer.host.str,
                                 thd->db))
     {
-      my_error(ER_NO_SUCH_USER, MYF(0), definer.user.str, definer.host.str);
-      DBUG_RETURN(TRUE);
+      if (thd->lex->sql_command == SQLCOM_SHOW_CREATE)
+      {
+        push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, 
+                            ER_NO_SUCH_USER, 
+                            ER(ER_NO_SUCH_USER),
+                            definer.user.str, definer.host.str);
+      }
+      else
+      {
+        my_error(ER_NO_SUCH_USER, MYF(0), definer.user.str, definer.host.str);
+        DBUG_RETURN(TRUE);
+      }
     }
   }
   DBUG_RETURN(FALSE);

--- 1.14/mysql-test/r/view_grant.result	2006-05-26 11:47:46 +03:00
+++ 1.15/mysql-test/r/view_grant.result	2006-05-26 11:57:52 +03:00
@@ -603,3 +603,18 @@
 DROP TABLE mysqltest1.t1;
 DROP USER readonly@localhost;
 DROP DATABASE mysqltest1;
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1), (2), (3);
+CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
+Warnings:
+Note	1449	There is no 'no-such-user'@'localhost' registered
+SHOW CREATE VIEW v;
+View	Create View
+v	CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW
`v` AS select `t1`.`a` AS `a` from `t1`
+Warnings:
+Note	1449	There is no 'no-such-user'@'localhost' registered
+SELECT * FROM v;
+ERROR HY000: There is no 'no-such-user'@'localhost' registered
+DROP VIEW v;
+DROP TABLE t1;
+USE test;

--- 1.12/mysql-test/t/view_grant.test	2006-05-26 11:47:46 +03:00
+++ 1.13/mysql-test/t/view_grant.test	2006-05-26 11:57:52 +03:00
@@ -793,3 +793,17 @@
 DROP TABLE mysqltest1.t1;
 DROP USER readonly@localhost; 
 DROP DATABASE mysqltest1;
+
+#
+# BUG#14875: Bad view DEFINER makes SHOW CREATE VIEW fail
+#
+CREATE TABLE t1 (a INT PRIMARY KEY);
+INSERT INTO t1 VALUES (1), (2), (3);
+CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
+--warning 1448
+SHOW CREATE VIEW v;
+--error 1449
+SELECT * FROM v;
+DROP VIEW v;
+DROP TABLE t1;
+USE test;
Thread
bk commit into 5.0 tree (gkodinov:1.2149)kgeorge26 May