Browse Source

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.
pull/73/head
Mats Kindahl 16 years ago
parent
commit
0768deeb27
  1. 1
      sql/event_data_objects.cc
  2. 1
      sql/item.cc
  3. 1
      sql/item_func.cc
  4. 1
      sql/log.cc
  5. 2
      sql/mysqld.cc
  6. 1
      sql/set_var.cc
  7. 1
      sql/sp_head.cc
  8. 1
      sql/sp_head.h
  9. 1
      sql/sql_acl.cc
  10. 1
      sql/sql_acl.h
  11. 1
      sql/sql_base.cc
  12. 1
      sql/sql_cache.cc
  13. 1
      sql/sql_class.cc
  14. 1
      sql/sql_class.h
  15. 2
      sql/sql_connect.cc
  16. 1
      sql/sql_db.cc
  17. 1
      sql/sql_derived.cc
  18. 1
      sql/sql_insert.cc
  19. 10
      sql/sql_parse.cc
  20. 6
      sql/sql_parse.h
  21. 1
      sql/sql_prepare.cc
  22. 1
      sql/sql_show.cc
  23. 1
      sql/sql_trigger.cc
  24. 1
      sql/sql_update.cc
  25. 1
      sql/sql_view.cc
  26. 1
      sql/sys_vars.cc
  27. 1
      sql/table.cc
  28. 1
      sql/table.h

1
sql/event_data_objects.cc

@ -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

1
sql/item.cc

@ -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>

1
sql/item_func.cc

@ -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

1
sql/log.cc

@ -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

2
sql/mysqld.cc

@ -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

1
sql/set_var.cc

@ -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"

1
sql/sp_head.cc

@ -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"

1
sql/sp_head.h

@ -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

1
sql/sql_acl.cc

@ -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

1
sql/sql_acl.h

@ -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 */

1
sql/sql_base.cc

@ -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"

1
sql/sql_cache.cc

@ -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

1
sql/sql_class.cc

@ -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"

1
sql/sql_class.h

@ -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

2
sql/sql_connect.cc

@ -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

1
sql/sql_db.cc

@ -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"

1
sql/sql_derived.cc

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

1
sql/sql_insert.cc

@ -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"

10
sql/sql_parse.cc

@ -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)
{

6
sql/sql_parse.h

@ -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,

1
sql/sql_prepare.cc

@ -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

1
sql/sql_show.cc

@ -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

1
sql/sql_trigger.cc

@ -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"

1
sql/sql_update.cc

@ -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"

1
sql/sql_view.cc

@ -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"

1
sql/sys_vars.cc

@ -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"

1
sql/table.cc

@ -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"

1
sql/table.h

@ -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"

Loading…
Cancel
Save