List:Commits« Previous MessageNext Message »
From:jani Date:April 13 2007 9:47am
Subject:bk commit into 5.1 tree (jani:1.2578)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jani. When jani 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@stripped, 2007-04-13 12:47:44+03:00, jani@stripped +2 -0
  Merged from 5.0

  mysql-test/r/grant.result@stripped, 2007-04-13 12:47:39+03:00, jani@stripped +10 -10
    Merged from 5.0

  sql/sql_parse.cc@stripped, 2007-04-13 12:47:39+03:00, jani@stripped +59 -75
    Merged from 5.0

# 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:	jani
# Host:	a88-113-38-195.elisa-laajakaista.fi
# Root:	/home/my/new/mysql-5.1-marvel

--- 1.658/sql/sql_parse.cc	2007-04-13 10:25:27 +03:00
+++ 1.659/sql/sql_parse.cc	2007-04-13 12:47:39 +03:00
@@ -1358,8 +1358,8 @@
 int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
                          enum enum_schema_tables schema_table_idx)
 {
-  DBUG_ENTER("prepare_schema_table");
   SELECT_LEX *schema_select_lex= NULL;
+  DBUG_ENTER("prepare_schema_table");
 
   switch (schema_table_idx) {
   case SCH_SCHEMATA:
@@ -1393,6 +1393,7 @@
       db.str= schema_select_lex->db= lex->select_lex.db;
       schema_select_lex->table_list.first= NULL;
       db.length= strlen(db.str);
+
       if (check_db_name(&db))
       {
         my_error(ER_WRONG_DB_NAME, MYF(0), db.str);
@@ -1403,32 +1404,23 @@
 #endif
   case SCH_COLUMNS:
   case SCH_STATISTICS:
+  {
 #ifdef DONT_ALLOW_SHOW_COMMANDS
     my_message(ER_NOT_ALLOWED_COMMAND,
                ER(ER_NOT_ALLOWED_COMMAND), MYF(0)); /* purecov: inspected */
     DBUG_RETURN(1);
 #else
-    if (table_ident)
-    {
-      TABLE_LIST **query_tables_last= lex->query_tables_last;
-      sel= new SELECT_LEX();
-      /* 'parent_lex' is used in init_query() so it must be before it. */
-      sel->parent_lex= lex;
-      sel->init_query();
-      if (!sel->add_table_to_list(thd, table_ident, 0, 0, TL_READ))
-        DBUG_RETURN(1);
-      lex->query_tables_last= query_tables_last;
-      TABLE_LIST *table_list= (TABLE_LIST*) sel->table_list.first;
-      char *db= table_list->db;
-      if (check_access(thd,SELECT_ACL | EXTRA_ACL,db,
-                       &table_list->grant.privilege, 0, 0,
-                       test(table_list->schema_table)))
-        DBUG_RETURN(1);				/* purecov: inspected */
-      if (grant_option && check_grant(thd, SELECT_ACL, table_list, 2,
-                                      UINT_MAX, 0))
-        DBUG_RETURN(1);
-      break;
-    }
+    DBUG_ASSERT(table_ident);
+    TABLE_LIST **query_tables_last= lex->query_tables_last;
+    schema_select_lex= new SELECT_LEX();
+    /* 'parent_lex' is used in init_query() so it must be before it. */
+    schema_select_lex->parent_lex= lex;
+    schema_select_lex->init_query();
+    if (!schema_select_lex->add_table_to_list(thd, table_ident, 0, 0, TL_READ))
+      DBUG_RETURN(1);
+    lex->query_tables_last= query_tables_last;
+    break;
+  }
 #endif
   case SCH_OPEN_TABLES:
   case SCH_VARIABLES:
@@ -1454,7 +1446,7 @@
     DBUG_RETURN(1);
   }
   TABLE_LIST *table_list= (TABLE_LIST*) select_lex->table_list.first;
-  table_list->schema_select_lex= sel;
+  table_list->schema_select_lex= schema_select_lex;
   table_list->schema_table_reformed= 1;
   DBUG_RETURN(0);
 }
@@ -4691,74 +4683,57 @@
 
 static bool check_show_access(THD *thd, TABLE_LIST *table)
 {
-  switch (get_schema_table_idx(table->schema_table))
-  {
+  switch (get_schema_table_idx(table->schema_table)) {
   case SCH_SCHEMATA:
     return (specialflag & SPECIAL_SKIP_SHOW_DB) &&
-           check_global_access(thd, SHOW_DB_ACL);
+      check_global_access(thd, SHOW_DB_ACL);
 
   case SCH_TABLE_NAMES:
   case SCH_TABLES:
   case SCH_VIEWS:
   case SCH_TRIGGERS:
-    {
-      const char *dst_db_name= table->schema_select_lex->db;
-
-      DBUG_ASSERT(dst_db_name);
+  case SCH_EVENTS:
+  {
+    const char *dst_db_name= table->schema_select_lex->db;
 
-      if (check_access(thd, SELECT_ACL, dst_db_name,
-                       &thd->col_access, FALSE, FALSE,
-                       is_schema_db(dst_db_name)))
-      {
-        return TRUE;
-      }
+    DBUG_ASSERT(dst_db_name);
 
-      if (!thd->col_access && check_grant_db(thd, dst_db_name))
-      {
-        my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
-                 thd->security_ctx->priv_user,
-                 thd->security_ctx->priv_host,
-                 dst_db_name);
-        return TRUE;
-      }
+    if (check_access(thd, SELECT_ACL, dst_db_name,
+                     &thd->col_access, FALSE, FALSE,
+                     is_schema_db(dst_db_name)))
+      return TRUE;
 
-      return FALSE;
+    if (!thd->col_access && check_grant_db(thd, dst_db_name))
+    {
+      my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
+               thd->security_ctx->priv_user,
+               thd->security_ctx->priv_host,
+               dst_db_name);
+      return TRUE;
     }
 
+    return FALSE;
+  }
+
   case SCH_COLUMNS:
   case SCH_STATISTICS:
-    {
-      TABLE_LIST *dst_table=
-        (TABLE_LIST *) table->schema_select_lex->table_list.first;
+  {
+    TABLE_LIST *dst_table;
+    dst_table= (TABLE_LIST *) table->schema_select_lex->table_list.first;
 
-      DBUG_ASSERT(dst_table);
+    DBUG_ASSERT(dst_table);
 
-      if (check_access(thd, SELECT_ACL | EXTRA_ACL,
-                       dst_table->db,
-                       &dst_table->grant.privilege,
-                       FALSE, FALSE,
-                       test(dst_table->schema_table)))
-      {
-        return FALSE;
-      }
-
-      return grant_option &&
-             check_grant(thd, SELECT_ACL, dst_table, 2, UINT_MAX, FALSE);
-    }
+    if (check_access(thd, SELECT_ACL | EXTRA_ACL,
+                     dst_table->db,
+                     &dst_table->grant.privilege,
+                     FALSE, FALSE,
+                     test(dst_table->schema_table)))
+      return FALSE;
 
-  case SCH_OPEN_TABLES:
-  case SCH_VARIABLES:
-  case SCH_STATUS:
-  case SCH_PROCEDURES:
-  case SCH_CHARSETS:
-  case SCH_COLLATIONS:
-  case SCH_COLLATION_CHARACTER_SET_APPLICABILITY:
-  case SCH_USER_PRIVILEGES:
-  case SCH_SCHEMA_PRIVILEGES:
-  case SCH_TABLE_PRIVILEGES:
-  case SCH_COLUMN_PRIVILEGES:
-  case SCH_TABLE_CONSTRAINTS:
-  case SCH_KEY_COLUMN_USAGE:
+    return (grant_option &&
+            check_grant(thd, SELECT_ACL, dst_table, 2, UINT_MAX, FALSE));
+  }
+  default:
     break;
   }
 
@@ -4826,7 +4801,16 @@
        Remove SHOW_VIEW_ACL, because it will be checked during making view
      */
     tables->grant.orig_want_privilege= (want_access & ~SHOW_VIEW_ACL);
-    if (tables->derived || tables->schema_table ||
+
+    if (tables->schema_table_reformed)
+    {
+      if (check_show_access(thd, tables))
+        goto deny;
+
+      continue;
+    }
+
+    if (tables->derived ||
         (tables->table && (int)tables->table->s->tmp_table))
       continue;
     thd->security_ctx= sctx;

--- 1.69/mysql-test/r/grant.result	2007-04-13 10:25:27 +03:00
+++ 1.70/mysql-test/r/grant.result	2007-04-13 12:47:39 +03:00
@@ -1106,16 +1106,6 @@
 DROP DATABASE mysqltest3;
 DROP DATABASE mysqltest4;
 DROP USER mysqltest_1@localhost;
-End of 5.0 tests
-set names utf8;
-grant select on test.* to юзер_юзер@localhost;
-user()
-юзер_юзер@localhost
-revoke all on test.* from юзер_юзер@localhost;
-drop user юзер_юзер@localhost;
-grant select on test.* to очень_длинный_юзер@localhost;
-ERROR HY000: String 'очень_длинный_юзер' is too long for user name (should be no longer than 16)
-set names default;
 DROP DATABASE IF EXISTS mysqltest1;
 DROP DATABASE IF EXISTS mysqltest2;
 CREATE DATABASE mysqltest1;
@@ -1191,3 +1181,13 @@
 DROP DATABASE mysqltest1;
 DROP DATABASE mysqltest2;
 DROP USER mysqltest_1@localhost;
+End of 5.0 tests
+set names utf8;
+grant select on test.* to юзер_юзер@localhost;
+user()
+юзер_юзер@localhost
+revoke all on test.* from юзер_юзер@localhost;
+drop user юзер_юзер@localhost;
+grant select on test.* to очень_длинный_юзер@localhost;
+ERROR HY000: String 'очень_длинный_юзер' is too long for user name (should be no longer than 16)
+set names default;
Thread
bk commit into 5.1 tree (jani:1.2578)jani13 Apr