List:Commits« Previous MessageNext Message »
From:dlenev Date:May 23 2007 11:43am
Subject:bk commit into 5.1 tree (dlenev:1.2535)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of dlenev. When dlenev 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-05-23 15:43:25+04:00, dlenev@stripped +1 -0
  Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
  into  mockturtle.local:/home/dlenev/src/mysql-5.1-like-2
  MERGE: 1.2529.2.1

  sql/sql_parse.cc@stripped, 2007-05-23 15:43:18+04:00, dlenev@stripped +0 -0
    Auto merged
    MERGE: 1.668.1.1

# 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:	dlenev
# Host:	mockturtle.local
# Root:	/home/dlenev/src/mysql-5.1-like-2/RESYNC

--- 1.669/sql/sql_parse.cc	2007-05-23 15:43:37 +04:00
+++ 1.670/sql/sql_parse.cc	2007-05-23 15:43:37 +04:00
@@ -39,6 +39,7 @@
    "FUNCTION" : "PROCEDURE")
 
 static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
+static bool check_show_create_table_access(THD *thd, TABLE_LIST *table);
 
 const char *any_db="*any*";	// Special symbol for check_access
 
@@ -2231,9 +2232,9 @@ mysql_execute_command(THD *thd)
       if (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)
         thd->options|= OPTION_KEEP_LOG;
       /* regular create */
-      if (lex->like_name)
-        res= mysql_create_like_table(thd, create_table, &lex->create_info, 
-                                     lex->like_name); 
+      if (lex->create_info.options & HA_LEX_CREATE_TABLE_LIKE)
+        res= mysql_create_like_table(thd, create_table, select_tables,
+                                     &lex->create_info);
       else
       {
         res= mysql_create_table(thd, create_table->db,
@@ -2423,12 +2424,7 @@ end_with_restore_list:
       /* Ignore temporary tables if this is "SHOW CREATE VIEW" */
       if (lex->only_view)
         first_table->skip_temporary= 1;
-
-      if (check_access(thd, SELECT_ACL | EXTRA_ACL, first_table->db,
-		       &first_table->grant.privilege, 0, 0, 
-                       test(first_table->schema_table)))
-	goto error;
-      if (grant_option && check_grant(thd, SELECT_ACL, all_tables, 2, UINT_MAX, 0))
+      if (check_show_create_table_access(thd, first_table))
 	goto error;
       res= mysqld_show_create(thd, first_table);
       break;
@@ -6845,6 +6841,25 @@ bool insert_precheck(THD *thd, TABLE_LIS
 }
 
 
+/**
+    @brief  Check privileges for SHOW CREATE TABLE statement.
+
+    @param  thd    Thread context
+    @param  table  Target table
+
+    @retval TRUE  Failure
+    @retval FALSE Success
+*/
+
+static bool check_show_create_table_access(THD *thd, TABLE_LIST *table)
+{
+  return check_access(thd, SELECT_ACL | EXTRA_ACL, table->db,
+                      &table->grant.privilege, 0, 0,
+                      test(table->schema_table)) ||
+         grant_option && check_grant(thd, SELECT_ACL, table, 2, UINT_MAX, 0);
+}
+
+
 /*
   CREATE TABLE query pre-check
 
@@ -6908,6 +6923,11 @@ bool create_table_precheck(THD *thd, TAB
     }
 #endif
     if (tables && check_table_access(thd, SELECT_ACL, tables,0))
+      goto err;
+  }
+  else if (lex->create_info.options & HA_LEX_CREATE_TABLE_LIKE)
+  {
+    if (check_show_create_table_access(thd, tables))
       goto err;
   }
   error= FALSE;
Thread
bk commit into 5.1 tree (dlenev:1.2535)dlenev23 May