MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:gluh Date:December 1 2005 9:04am
Subject:bk commit into 5.1 tree (gluh:1.1996) BUG#9785
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 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.1996 05/12/01 13:04:19 gluh@stripped +4 -0
  Fix for bug#9785 SELECT privilege for the whole database 
                   is needed to do SHOW CREATE DATABASE
    To allow SHOW CREATE DATABASE when the user can use the database

  sql/sql_show.cc
    1.285 05/12/01 13:02:45 gluh@stripped +0 -6
    Fix for bug#9785 SELECT privilege for the whole database 
                     is needed to do SHOW CREATE DATABASE
      removed unnecessary code

  sql/sql_parse.cc
    1.490 05/12/01 13:02:45 gluh@stripped +0 -2
    Fix for bug#9785 SELECT privilege for the whole database 
                     is needed to do SHOW CREATE DATABASE
      To allow SHOW CREATE DATABASE when the user can use the database

  mysql-test/t/show_check.test
    1.58 05/12/01 13:02:45 gluh@stripped +18 -1
    Fix for bug#9785 SELECT privilege for the whole database 
                     is needed to do SHOW CREATE DATABASE
      test case

  mysql-test/r/show_check.result
    1.85 05/12/01 13:02:45 gluh@stripped +17 -1
    Fix for bug#9785 SELECT privilege for the whole database 
                     is needed to do SHOW CREATE DATABASE
      test result

# 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.1-new

--- 1.489/sql/sql_parse.cc	Tue Nov 29 09:30:08 2005
+++ 1.490/sql/sql_parse.cc	Thu Dec  1 13:02:45 2005
@@ -3664,8 +3664,6 @@ end_with_restore_list:
       my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
       break;
     }
-    if (check_access(thd,SELECT_ACL,lex->name,0,1,0,is_schema_db(lex->name)))
-      break;
     res=mysqld_show_create_db(thd,lex->name,&lex->create_info);
     break;
   }

--- 1.284/sql/sql_show.cc	Thu Dec  1 11:08:05 2005
+++ 1.285/sql/sql_show.cc	Thu Dec  1 13:02:45 2005
@@ -482,12 +482,6 @@ bool mysqld_show_create_db(THD *thd, cha
   Protocol *protocol=thd->protocol;
   DBUG_ENTER("mysql_show_create_db");
 
-  if (check_db_name(dbname))
-  {
-    my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
-    DBUG_RETURN(TRUE);
-  }
-
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
   if (test_all_bits(sctx->master_access, DB_ACLS))
     db_access=DB_ACLS;

--- 1.84/mysql-test/r/show_check.result	Thu Dec  1 01:51:19 2005
+++ 1.85/mysql-test/r/show_check.result	Thu Dec  1 13:02:45 2005
@@ -397,7 +397,8 @@ ERROR 42000: Access denied for user 'mys
 select * from mysqltest.t1;
 ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
 show create database mysqltest;
-ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest'
+Database	Create Database
+mysqltest	CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
 drop table mysqltest.t1;
 drop database mysqltest;
 set names binary;
@@ -565,4 +566,19 @@ DROP TABLE urkunde;
 SHOW TABLES FROM non_existing_database;
 ERROR 42000: Unknown database 'non_existing_database'
 SHOW AUTHORS;
+create database mysqltest;
+show create database mysqltest;
+Database	Create Database
+mysqltest	CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
+create table mysqltest.t1(a int);
+insert into mysqltest.t1 values(1);
+grant select on `mysqltest`.`t1` to mysqltest_4@localhost;
+show create database mysqltest;
+Database	Create Database
+mysqltest	CREATE DATABASE `mysqltest` /*!40100 DEFAULT CHARACTER SET latin1 */
+delete from mysql.user where user='mysqltest_4';
+delete from mysql.db where user='mysqltest_4';
+delete from mysql.tables_priv where user='mysqltest_4';
+flush privileges;
+drop database mysqltest;
 End of 5.1 tests

--- 1.57/mysql-test/t/show_check.test	Tue Nov 29 03:32:21 2005
+++ 1.58/mysql-test/t/show_check.test	Thu Dec  1 13:02:45 2005
@@ -312,7 +312,6 @@ connect (con3,localhost,mysqltest_3,,tes
 connection con3;
 --error 1142
 select * from mysqltest.t1;
---error 1044
 show create database mysqltest;
 drop table mysqltest.t1;
 drop database mysqltest;
@@ -430,5 +429,23 @@ SHOW TABLES FROM non_existing_database;
 --disable_result_log
 SHOW AUTHORS;
 --enable_result_log
+
+#
+# Test for bug #9785 SELECT privilege for the whole database is needed to do SHOW CREATE DATABASE
+#
+create database mysqltest;
+show create database mysqltest;
+create table mysqltest.t1(a int);
+insert into mysqltest.t1 values(1);
+grant select on `mysqltest`.`t1` to mysqltest_4@localhost;
+connect (con4,localhost,mysqltest_4,,mysqltest);
+connection con4;
+show create database mysqltest;
+connection default;
+delete from mysql.user where user='mysqltest_4';
+delete from mysql.db where user='mysqltest_4';
+delete from mysql.tables_priv where user='mysqltest_4';
+flush privileges;
+drop database mysqltest;
 
 --echo End of 5.1 tests
Thread
bk commit into 5.1 tree (gluh:1.1996) BUG#9785gluh1 Dec