List:Commits« Previous MessageNext Message »
From:gluh Date:March 20 2006 10:42am
Subject:bk commit into 5.0 tree (gluh:1.2095) BUG#18113
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh 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.2095 06/03/20 13:42:02 gluh@stripped +4 -0
  Fix for bug #18113 "SELECT * FROM information_schema.xxx crashes server"
  
  Crash happened when one selected data from one of INFORMATION_SCHEMA
  tables and in order to build its contents server had to open view which
  used stored function and table or view on which one had not global or
  database-level privileges (e.g. had only table-level or had no
  privileges at all).
  
  The crash was caused by usage of check_grant() function, which assumes
  that either number of tables to be inspected by it is limited explicitly
  or table list used and thd->lex->query_tables_own_last value correspond
  to each other (the latter should be either 0 or point to next_global
  member of one of elements of this table list), in conditions when
  above assumptions were not true. This fix just explicitly limits
  number of tables to be inspected. Other negative effects which are
  caused by the fact that thd->lex->query_tables_own_last might not
  be set properly during processing of I_S tables are less disastrous
  and will be reported and fixed separetely.
  

  sql/sql_show.cc
    1.312 06/03/20 13:41:56 gluh@stripped +1 -1
    Fix for bug #18113 "SELECT * FROM information_schema.xxx crashes server"
    
    Crash happened when one selected data from one of INFORMATION_SCHEMA
    tables and in order to build its contents server had to open view which
    used stored function and table or view on which one had not global or
    database-level privileges (e.g. had only table-level or had no
    privileges at all).
    
    The crash was caused by usage of check_grant() function, which assumes
    that either number of tables to be inspected by it is limited explicitly
    or table list used and thd->lex->query_tables_own_last value correspond
    to each other (the latter should be either 0 or point to next_global
    member of one of elements of this table list), in conditions when
    above assumptions were not true. This fix just explicitly limits
    number of tables to be inspected. Other negative effects which are
    caused by the fact that thd->lex->query_tables_own_last might not
    be set properly during processing of I_S tables are less disastrous
    and will be reported and fixed separetely.
    

  sql/sql_acl.cc
    1.190 06/03/20 13:41:56 gluh@stripped +7 -0
      added note

  mysql-test/t/information_schema_db.test
    1.3 06/03/20 13:41:56 gluh@stripped +31 -0
    Fix for bug #18113 "SELECT * FROM information_schema.xxx crashes server"
      test case

  mysql-test/r/information_schema_db.result
    1.6 06/03/20 13:41:56 gluh@stripped +14 -0
    Fix for bug #18113 "SELECT * FROM information_schema.xxx crashes server"
      test case

# 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:	gluh
# Host:	eagle.intranet.mysql.r18.ru
# Root:	/home/gluh/MySQL/Merge/5.0

--- 1.189/sql/sql_acl.cc	Mon Mar  6 14:38:26 2006
+++ 1.190/sql/sql_acl.cc	Mon Mar 20 13:41:56 2006
@@ -3537,6 +3537,13 @@ end:
    RETURN
      0  ok
      1  Error: User did not have the requested privileges
+
+   NOTE
+     This functions assumes that either number of tables to be inspected
+     by it is limited explicitly (i.e. is is not UINT_MAX) or table list
+     used and thd->lex->query_tables_own_last value correspond to each
+     other (the latter should be either 0 or point to next_global member
+     of one of elements of this table list).
 ****************************************************************************/
 
 bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,

--- 1.311/sql/sql_show.cc	Fri Mar 10 15:40:12 2006
+++ 1.312/sql/sql_show.cc	Mon Mar 20 13:41:56 2006
@@ -328,7 +328,7 @@ mysql_find_files(THD *thd,List<char> *fi
       table_list.table_name= file->name;
       table_list.table_name_length= strlen(file->name);
       table_list.grant.privilege=col_access;
-      if (check_grant(thd, TABLE_ACLS, &table_list, 1, UINT_MAX, 1))
+      if (check_grant(thd, TABLE_ACLS, &table_list, 1, 1, 1))
         continue;
     }
 #endif

--- 1.5/mysql-test/r/information_schema_db.result	Sun Jan 29 05:44:11 2006
+++ 1.6/mysql-test/r/information_schema_db.result	Mon Mar 20 13:41:56 2006
@@ -27,4 +27,18 @@ create database `inf%`;
 use `inf%`;
 show tables;
 Tables_in_inf%
+grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
+create table t1 (f1 int);
+create function func1(curr_int int) returns int
+begin
+declare ret_val int;
+select max(f1) from t1 into ret_val;
+return ret_val;
+end|
+create view v1 as select f1 from t1 where f1 = func1(f1);
+select * from information_schema.tables;
+drop user mysqltest_1@localhost;
+drop view v1;
+drop function func1;
+drop table t1;
 drop database `inf%`;

--- 1.2/mysql-test/t/information_schema_db.test	Tue May 24 15:35:16 2005
+++ 1.3/mysql-test/t/information_schema_db.test	Mon Mar 20 13:41:56 2006
@@ -8,4 +8,35 @@ show tables from INFORMATION_SCHEMA like
 create database `inf%`;
 use `inf%`;
 show tables;
+
+#
+# Bug#18113 SELECT * FROM information_schema.xxx crashes server
+# Crash happened when one selected data from one of INFORMATION_SCHEMA
+# tables and in order to build its contents server had to open view which
+# used stored function and table or view on which one had not global or
+# database-level privileges (e.g. had only table-level or had no
+# privileges at all).
+#
+grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
+create table t1 (f1 int);
+delimiter |;
+create function func1(curr_int int) returns int
+begin
+  declare ret_val int;
+  select max(f1) from t1 into ret_val;
+  return ret_val;
+end|
+delimiter ;|
+create view v1 as select f1 from t1 where f1 = func1(f1);
+connect (user1,localhost,mysqltest_1,,);
+connection user1;
+--disable_result_log
+select * from information_schema.tables;
+--enable_result_log
+connection default;
+drop user mysqltest_1@localhost;
+drop view v1;
+drop function func1;
+drop table t1;
+
 drop database `inf%`;
Thread
bk commit into 5.0 tree (gluh:1.2095) BUG#18113gluh20 Mar