MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:kgeorge Date:May 26 2006 8:49am
Subject:bk commit into 5.0 tree (gkodinov:1.2137) BUG#14875
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.2137 06/05/26 11:49:39 gkodinov@stripped +4 -0
  Bug #14875: Bad view DEFINER makes SHOW CREATE VIEW fail
  
  When reading a view definition from a .frm file it was
  throwing a SQL error if the DEFINER user is not defined.
  Changed it to a warning to match the (documented) case
  when a view with undefined DEFINER user is created.

  sql/table.cc
    1.219 06/05/26 11:49:34 gkodinov@stripped +12 -2
    Turned the error of undefined DEFINER user in reading 
    a view definition to a warning. 

  sql/sql_acl.cc
    1.194 06/05/26 11:49:34 gkodinov@stripped +2 -0
    Initialized the members to no privileges so even if
    the subsequent checks fail it will still initialize
    the security context.

  mysql-test/t/view_grant.test
    1.12 06/05/26 11:49:34 gkodinov@stripped +14 -0
    test case for the bug

  mysql-test/r/view_grant.result
    1.14 06/05/26 11:49:34 gkodinov@stripped +15 -0
    test case 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/B14875

--- 1.193/sql/sql_acl.cc	2006-05-15 13:36:42 +03:00
+++ 1.194/sql/sql_acl.cc	2006-05-26 11:49:34 +03:00
@@ -959,6 +959,8 @@
 
   sctx->master_access= 0;
   sctx->db_access= 0;
+  sctx->priv_user= (char *) "";
+  *sctx->priv_host= 0;
 
   /*
      Find acl entry in user database.

--- 1.218/sql/table.cc	2006-03-22 11:11:23 +02:00
+++ 1.219/sql/table.cc	2006-05-26 11:49:34 +03:00
@@ -2428,8 +2428,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.13/mysql-test/r/view_grant.result	2006-05-12 19:58:51 +03:00
+++ 1.14/mysql-test/r/view_grant.result	2006-05-26 11:49:34 +03:00
@@ -533,3 +533,18 @@
 v2	CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select 1 AS `1`
 drop view v1;
 drop view v2;
+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.11/mysql-test/t/view_grant.test	2006-03-10 13:40:12 +02:00
+++ 1.12/mysql-test/t/view_grant.test	2006-05-26 11:49:34 +03:00
@@ -712,3 +712,17 @@
 show create view v2;
 drop view v1;
 drop view v2;
+
+#
+# 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.2137) BUG#14875kgeorge26 May