List:Internals« Previous MessageNext Message »
From:gluh Date:May 7 2005 5:14pm
Subject:bk commit into 5.0 tree (gluh:1.1937) BUG#10261
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.1937 05/05/07 15:14:34 gluh@stripped +3 -0
  Fix for bug#10261: INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user
     I_S table columns information is available for any user 

  sql/sql_show.cc
    1.242 05/05/07 15:14:28 gluh@stripped +8 -2
    Fix for bug#10261: INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user

  mysql-test/t/information_schema.test
    1.35 05/05/07 15:14:28 gluh@stripped +13 -0
    Fix for bug#10261: INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user

  mysql-test/r/information_schema.result
    1.49 05/05/07 15:14:28 gluh@stripped +14 -0
    Fix for bug#10261: INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user

# 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:	mobby.(none)
# Root:	/home/gluh/MySQL/Bugs/5.0.10261

--- 1.241/sql/sql_show.cc	2005-05-07 13:55:41 +00:00
+++ 1.242/sql/sql_show.cc	2005-05-07 15:14:28 +00:00
@@ -2306,7 +2306,8 @@
       col_access= get_column_grant(thd, &tables->grant, 
                                    base_name, file_name,
                                    field->field_name) & COL_ACLS;
-      if (lex->orig_sql_command != SQLCOM_SHOW_FIELDS  && !col_access)
+      if (lex->orig_sql_command != SQLCOM_SHOW_FIELDS  && 
+          !tables->schema_table && !col_access)
         continue;
       for (uint bitnr=0; col_access ; col_access>>=1,bitnr++)
       {
@@ -2319,7 +2320,12 @@
 #else
       *end= 0;
 #endif
-      table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs);
+      if (tables->schema_table)      // any user has 'select' privilege on all 
+                                     // I_S table columns
+        table->field[17]->store(grant_types.type_names[0],
+                                strlen(grant_types.type_names[0]), cs);
+      else
+        table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs);
 
       table->field[1]->store(base_name, strlen(base_name), cs);
       table->field[2]->store(file_name, strlen(file_name), cs);

--- 1.48/mysql-test/r/information_schema.result	2005-05-07 13:55:41 +00:00
+++ 1.49/mysql-test/r/information_schema.result	2005-05-07 15:14:28 +00:00
@@ -734,3 +734,17 @@
 x_float	NULL	NULL
 x_double_precision	NULL	NULL
 drop table t1;
+create user mysqltest_4@localhost;
+SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS 
+where COLUMN_NAME='TABLE_NAME';
+TABLE_NAME	COLUMN_NAME	PRIVILEGES
+TABLES	TABLE_NAME	select
+COLUMNS	TABLE_NAME	select
+STATISTICS	TABLE_NAME	select
+VIEWS	TABLE_NAME	select
+TABLE_PRIVILEGES	TABLE_NAME	select
+COLUMN_PRIVILEGES	TABLE_NAME	select
+TABLE_CONSTRAINTS	TABLE_NAME	select
+KEY_COLUMN_USAGE	TABLE_NAME	select
+delete from mysql.user where user='mysqltest_4';
+flush privileges;

--- 1.34/mysql-test/t/information_schema.test	2005-05-07 13:55:41 +00:00
+++ 1.35/mysql-test/t/information_schema.test	2005-05-07 15:14:28 +00:00
@@ -473,3 +473,16 @@
 FROM INFORMATION_SCHEMA.COLUMNS
 WHERE TABLE_NAME= 't1';
 drop table t1;
+
+#
+# Bug#10261  INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user
+#
+
+create user mysqltest_4@localhost;
+connect (user4,localhost,mysqltest_4,,);
+connection user4;
+SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS 
+where COLUMN_NAME='TABLE_NAME';
+connection default;
+delete from mysql.user where user='mysqltest_4';
+flush privileges;
Thread
bk commit into 5.0 tree (gluh:1.1937) BUG#10261gluh7 May