WL#5030: Splitting mysql_priv.h

Adding my_global.h first in all files using
NO_EMBEDDED_ACCESS_CHECKS.

Correcting a merge problem resulting from a changed definition
of check_some_access compared to the original patches.
This commit is contained in:
Mats Kindahl 2010-04-07 13:58:40 +02:00
parent e92b3c587c
commit 46bd78b9ee
28 changed files with 41 additions and 3 deletions

View File

@ -14,6 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_LEX 1
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "sql_parse.h" // parse_sql

View File

@ -17,6 +17,7 @@
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation
#endif
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include <mysql.h>

View File

@ -25,6 +25,7 @@
#pragma implementation // gcc: Class implementation
#endif
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
/*
It is necessary to include set_var.h instead of item.h because there

View File

@ -24,6 +24,7 @@
Abort logging when we get an error in reading or writing log files
*/
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "log.h"
#include "sql_base.h" // close_thread_tables

View File

@ -13,9 +13,9 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "my_global.h"
#include <signal.h>
#ifndef __WIN__
#include <netdb.h> // getservbyname, servent

View File

@ -19,6 +19,7 @@
/* variable declarations are in sys_vars.cc now !!! */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_class.h" // set_var.h: session_var_ptr
#include "set_var.h"
#include "sql_priv.h"

View File

@ -13,6 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "sql_prepare.h"

View File

@ -26,6 +26,7 @@
are dependencies on include order for set_var.h and item.h. This
will be resolved later.
*/
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_class.h" // THD, set_var.h: THD
#include "set_var.h" // Item

View File

@ -24,6 +24,7 @@
in the relevant fields. Empty strings comes last.
*/
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "sql_acl.h" // MYSQL_DB_FIELD_COUNT, ACL_ACCESS
#include "sql_base.h" // close_thread_tables

View File

@ -16,6 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "violite.h" /* SSL_type */
#include "sql_class.h" /* LEX_COLUMN */

View File

@ -16,6 +16,7 @@
/* Basic functions needed by many modules */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "debug_sync.h"

View File

@ -327,6 +327,7 @@ TODO list:
(This could be done with almost no speed penalty)
*/
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "sql_cache.h"
#include "sql_parse.h" // check_table_access

View File

@ -25,6 +25,7 @@
#pragma implementation // gcc: Class implementation
#endif
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "sql_class.h"

View File

@ -23,6 +23,7 @@
#pragma interface /* gcc class implementation */
#endif
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#ifdef MYSQL_SERVER
#include "unireg.h" // REQUIRED: for other includes
#endif

View File

@ -18,8 +18,8 @@
Functions to autenticate and handle reqests for a connection
*/
#include "sql_priv.h"
#include "my_global.h"
#include "sql_priv.h"
#ifndef __WIN__
#include <netdb.h> // getservbyname, servent
#endif

View File

@ -16,6 +16,7 @@
/* create and drop of databases */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "sql_db.h"

View File

@ -20,6 +20,7 @@
*/
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "sql_derived.h"

View File

@ -54,6 +54,7 @@
*/
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "sql_insert.h"

View File

@ -14,6 +14,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define MYSQL_LEX 1
#include "my_global.h"
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "sql_parse.h" // sql_kill, *_precheck, *_prepare
@ -94,6 +95,8 @@
#include "probes_mysql.h"
#include "set_var.h"
#define FLAGSTR(V,F) ((V)&(F)?#F" ":"")
/**
@defgroup Runtime_Environment Runtime Environment
@{
@ -2908,15 +2911,20 @@ end_with_restore_list:
NOTE: SHOW_VIEW ACL is checked when the view is created.
*/
DBUG_PRINT("debug", ("lex->only_view: %d, table: %s.%s",
lex->only_view,
first_table->db, first_table->table_name));
if (lex->only_view)
{
if (check_table_access(thd, SELECT_ACL, first_table, FALSE, 1, FALSE))
{
DBUG_PRINT("debug", ("check_table_access failed"));
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
"SHOW", thd->security_ctx->priv_user,
thd->security_ctx->host_or_ip, first_table->alias);
goto error;
}
DBUG_PRINT("debug", ("check_table_access succeeded"));
/* Ignore temporary tables if this is "SHOW CREATE VIEW" */
first_table->open_type= OT_BASE_ONLY;
@ -2929,6 +2937,8 @@ end_with_restore_list:
access is granted. We need to check if first_table->grant.privilege
contains any table-specific privilege.
*/
DBUG_PRINT("debug", ("first_table->grant.privilege: %x",
first_table->grant.privilege));
if (check_some_access(thd, SHOW_CREATE_TABLE_ACLS, first_table) ||
(first_table->grant.privilege & SHOW_CREATE_TABLE_ACLS) == 0)
{

View File

@ -16,6 +16,7 @@
#ifndef SQL_PARSE_INCLUDED
#define SQL_PARSE_INCLUDED
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_acl.h" /* GLOBAL_ACLS */
class Comp_creator;
@ -177,7 +178,10 @@ 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; }
{
table->grant.privilege= want_access;
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,

View File

@ -83,6 +83,7 @@ When one supplies long data for a placeholder:
at statement execute.
*/
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "sql_class.h" // set_var.h: THD

View File

@ -16,6 +16,7 @@
/* Function with list databases, tables or fields */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "sql_acl.h" // fill_schema_*_privileges

View File

@ -15,6 +15,7 @@
#define MYSQL_LEX 1
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "sp_head.h"

View File

@ -19,6 +19,7 @@
Multi-table updates were introduced by Sinisa & Monty
*/
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "sql_update.h"

View File

@ -15,6 +15,7 @@
*/
#define MYSQL_LEX 1
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h"
#include "sql_view.h"

View File

@ -27,6 +27,7 @@
(for example in storage/myisam/ha_myisam.cc) !
*/
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "sql_class.h" // set_var.h: THD
#include "sys_vars.h"

View File

@ -16,6 +16,7 @@
/* Some general useful functions */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "unireg.h" // REQUIRED: for other includes
#include "table.h"

View File

@ -16,6 +16,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "my_global.h" /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_plist.h"
#include "sql_list.h" /* Sql_alloc */
#include "mdl.h"