MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:holyfoot Date:November 13 2007 8:10am
Subject:bk commit into 5.1 tree (holyfoot:1.2625) BUG#31960
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of hf. When hf 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-11-13 12:10:22+04:00, holyfoot@stripped +2 -0
  Bug #31960 All embedded test crash
  
  Crash happens as a result of NO_EMBEDDED_ACCESS_CHECKS option
  (which is default for embedded server).
  check_table_access failed on using unintialized structure.
  Better solutions here is to disable that code completely in this case.
  Though the crash happens only in 6.0 i belive it's good to do it in 5.1

  sql/mysql_priv.h@stripped, 2007-11-13 12:10:19+04:00, holyfoot@stripped +36 -0
    Bug #31960 All embedded test crash.
    
    Access check functions from sql_parse.cc defined as FALSE if
    NO_EMBEDDED_ACCESS_CHECKS

  sql/sql_parse.cc@stripped, 2007-11-13 12:10:20+04:00, holyfoot@stripped +2 -18
    Bug #31960 All embedded test crash.
    
    Implementation of access checkings functions #ifdefed out for
    NO_EMBEDDED_ACCESS_CHECKS

diff -Nrup a/sql/mysql_priv.h b/sql/mysql_priv.h
--- a/sql/mysql_priv.h	2007-10-29 11:34:28 +04:00
+++ b/sql/mysql_priv.h	2007-11-13 12:10:19 +04:00
@@ -680,6 +680,8 @@ void free_items(Item *item);
 void cleanup_items(Item *item);
 class THD;
 void close_thread_tables(THD *thd, bool locked=0, bool skip_derived=0);
+
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
 bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables);
 bool check_single_table_access(THD *thd, ulong privilege,
 			   TABLE_LIST *tables, bool no_errors);
@@ -688,6 +690,24 @@ bool check_routine_access(THD *thd,ulong
 bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table);
 bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list);
 bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc);
+#else
+inline bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables)
+{ return false; }
+inline bool check_single_table_access(THD *thd, ulong privilege,
+			   TABLE_LIST *tables, bool no_errors)
+{ return false; }
+inline bool check_routine_access(THD *thd,ulong want_access,char *db,
+                                 char *name, bool is_proc, bool no_errors)
+{ return false; }
+inline bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table)
+{ return false; }
+inline bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list)
+{ return false; }
+inline bool check_some_routine_access(THD *thd, const char *db,
+                                      const char *name, bool is_proc)
+{ return false; }
+#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
+
 bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
 bool multi_delete_precheck(THD *thd, TABLE_LIST *tables);
 bool mysql_multi_update_prepare(THD *thd);
@@ -992,11 +1012,27 @@ void kill_mysql(void);
 void close_connection(THD *thd, uint errcode, bool lock);
 bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, 
                           bool *write_to_binlog);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
 bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv,
 		  bool no_grant, bool no_errors, bool schema_db);
 bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
 			bool no_errors);
 bool check_global_access(THD *thd, ulong want_access);
+#else
+inline bool check_access(THD *thd, ulong access, const char *db,
+                         ulong *save_priv, bool no_grant, bool no_errors,
+                         bool schema_db)
+{
+  if (save_priv)
+    *save_priv= GLOBAL_ACLS;
+  return false;
+}
+inline bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
+			bool no_errors)
+{ return false; }
+inline bool check_global_access(THD *thd, ulong want_access)
+{ return false; }
+#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
 
 /*
   Support routine for SQL parser on partitioning syntax
diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc
--- a/sql/sql_parse.cc	2007-10-23 20:10:27 +05:00
+++ b/sql/sql_parse.cc	2007-11-13 12:10:20 +04:00
@@ -3893,14 +3893,12 @@ create_sp_error:
 	  thd->server_status|= SERVER_MORE_RESULTS_EXISTS;
 	}
 
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
 	if (check_routine_access(thd, EXECUTE_ACL,
 				 sp->m_db.str, sp->m_name.str, TRUE, FALSE))
 	{
 	  thd->net.no_send_ok= save_no_send_ok;
 	  goto error;
 	}
-#endif
 	select_limit= thd->variables.select_limit;
 	thd->variables.select_limit= HA_POS_ERROR;
 
@@ -4580,6 +4578,7 @@ static bool execute_sqlcom_select(THD *t
 }
 
 
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
 /*
   Check grants for commands which work only with one table.
 
@@ -4697,7 +4696,6 @@ check_access(THD *thd, ulong want_access
 	     bool dont_check_global_grants, bool no_errors, bool schema_db)
 {
   Security_context *sctx= thd->security_ctx;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
   ulong db_access;
   /*
     GRANT command:
@@ -4710,7 +4708,6 @@ check_access(THD *thd, ulong want_access
   */
   bool  db_is_pattern= (test(want_access & GRANT_ACL) &&
                         dont_check_global_grants);
-#endif
   ulong dummy;
   DBUG_ENTER("check_access");
   DBUG_PRINT("enter",("db: %s  want_access: %lu  master_access: %lu",
@@ -4749,9 +4746,6 @@ check_access(THD *thd, ulong want_access
     }
   }
 
-#ifdef NO_EMBEDDED_ACCESS_CHECKS
-  DBUG_RETURN(0);
-#else
   if ((sctx->master_access & want_access) == want_access)
   {
     /*
@@ -4809,7 +4803,6 @@ check_access(THD *thd, ulong want_access
                          thd->db :
                          "unknown")));          /* purecov: tested */
   DBUG_RETURN(TRUE);				/* purecov: tested */
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
 }
 
 
@@ -4834,16 +4827,12 @@ check_access(THD *thd, ulong want_access
 
 bool check_global_access(THD *thd, ulong want_access)
 {
-#ifdef NO_EMBEDDED_ACCESS_CHECKS
-  return 0;
-#else
   char command[128];
   if ((thd->security_ctx->master_access & want_access))
     return 0;
   get_privilege_desc(command, sizeof(command), want_access);
   my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), command);
   return 1;
-#endif /* NO_EMBEDDED_ACCESS_CHECKS */
 }
 
 
@@ -4933,9 +4922,7 @@ bool
 check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
 		   bool no_errors)
 {
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
   TABLE_LIST *org_tables= tables;
-#endif
   TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
   Security_context *sctx= thd->security_ctx, *backup_ctx= thd->security_ctx;
   /*
@@ -5022,11 +5009,7 @@ check_routine_access(THD *thd, ulong wan
 			0, no_errors, 0))
     return TRUE;
   
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
     return check_grant_routine(thd, want_access, tables, is_proc, no_errors);
-#else
-  return FALSE;
-#endif
 }
 
 
@@ -5116,6 +5099,7 @@ bool check_merge_table_access(THD *thd, 
   return error;
 }
 
+#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
 
 /****************************************************************************
 	Check stack size; Send error if there isn't enough stack to continue
Thread
bk commit into 5.1 tree (holyfoot:1.2625) BUG#31960holyfoot13 Nov
  • Re: bk commit into 5.1 tree (holyfoot:1.2625) BUG#31960Sergei Golubchik19 Nov