summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMats Kindahl <mats@sun.com>2010-04-07 13:58:40 +0200
committerMats Kindahl <mats@sun.com>2010-04-07 13:58:40 +0200
commit0768deeb2707ac1b0f5061237ed02faa976381e7 (patch)
tree2f3a5f2cd336f0187f122dc5818b89361570f074
parent2c79d4d02b46d76f1aa19070d741bb3cc59adcfe (diff)
downloadmariadb-git-0768deeb2707ac1b0f5061237ed02faa976381e7.tar.gz
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.
-rw-r--r--sql/event_data_objects.cc1
-rw-r--r--sql/item.cc1
-rw-r--r--sql/item_func.cc1
-rw-r--r--sql/log.cc1
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/set_var.cc1
-rw-r--r--sql/sp_head.cc1
-rw-r--r--sql/sp_head.h1
-rw-r--r--sql/sql_acl.cc1
-rw-r--r--sql/sql_acl.h1
-rw-r--r--sql/sql_base.cc1
-rw-r--r--sql/sql_cache.cc1
-rw-r--r--sql/sql_class.cc1
-rw-r--r--sql/sql_class.h1
-rw-r--r--sql/sql_connect.cc2
-rw-r--r--sql/sql_db.cc1
-rw-r--r--sql/sql_derived.cc1
-rw-r--r--sql/sql_insert.cc1
-rw-r--r--sql/sql_parse.cc10
-rw-r--r--sql/sql_parse.h6
-rw-r--r--sql/sql_prepare.cc1
-rw-r--r--sql/sql_show.cc1
-rw-r--r--sql/sql_trigger.cc1
-rw-r--r--sql/sql_update.cc1
-rw-r--r--sql/sql_view.cc1
-rw-r--r--sql/sys_vars.cc1
-rw-r--r--sql/table.cc1
-rw-r--r--sql/table.h1
28 files changed, 41 insertions, 3 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index e22bfbad141..28fd1e240a2 100644
--- a/sql/event_data_objects.cc
+++ b/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
diff --git a/sql/item.cc b/sql/item.cc
index 24b8e0d5401..209d5aa0197 100644
--- a/sql/item.cc
+++ b/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>
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 63af030a027..4d0dec25e64 100644
--- a/sql/item_func.cc
+++ b/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
diff --git a/sql/log.cc b/sql/log.cc
index a3b9a8f835f..551072d2d47 100644
--- a/sql/log.cc
+++ b/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
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e8e7b5bb3ef..2bc47849915 100644
--- a/sql/mysqld.cc
+++ b/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
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 3f30dcb7df8..ec9c09f02a3 100644
--- a/sql/set_var.cc
+++ b/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"
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 2d197766782..62d53888149 100644
--- a/sql/sp_head.cc
+++ b/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"
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 66cbc47d8e0..165f88321a9 100644
--- a/sql/sp_head.h
+++ b/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
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index dae6123c38f..a5e5b4ec2a1 100644
--- a/sql/sql_acl.cc
+++ b/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
diff --git a/sql/sql_acl.h b/sql/sql_acl.h
index 1cbbedfe226..c0b536b7740 100644
--- a/sql/sql_acl.h
+++ b/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 */
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 51ab56083fc..3daaa71141a 100644
--- a/sql/sql_base.cc
+++ b/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"
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 2d47e3d4f6d..1e4161dfa1c 100644
--- a/sql/sql_cache.cc
+++ b/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
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index d47aae38f94..256f2fa730a 100644
--- a/sql/sql_class.cc
+++ b/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"
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 97d60a62780..950db01d1cd 100644
--- a/sql/sql_class.h
+++ b/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
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index c454933517f..cfcf1754581 100644
--- a/sql/sql_connect.cc
+++ b/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
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 3bd89cb7302..15fdd842e34 100644
--- a/sql/sql_db.cc
+++ b/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"
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index aea3b8b1d20..e86ae52e501 100644
--- a/sql/sql_derived.cc
+++ b/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"
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 216e3a65dfe..103be4c851f 100644
--- a/sql/sql_insert.cc
+++ b/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"
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 3dc372f7304..8dc5f4a8c56 100644
--- a/sql/sql_parse.cc
+++ b/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)
{
diff --git a/sql/sql_parse.h b/sql/sql_parse.h
index 0dae572b6a4..90a37c7e244 100644
--- a/sql/sql_parse.h
+++ b/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,
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 89d450d9061..739b6576a99 100644
--- a/sql/sql_prepare.cc
+++ b/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
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 06c6f4d6b59..1b77e20cc02 100644
--- a/sql/sql_show.cc
+++ b/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
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 9f45ce3919e..701a2ec93c2 100644
--- a/sql/sql_trigger.cc
+++ b/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"
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 3adee53f0be..3d9a2f74451 100644
--- a/sql/sql_update.cc
+++ b/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"
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 004b7d80124..3a6866f4a7e 100644
--- a/sql/sql_view.cc
+++ b/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"
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 9fcf968ff31..3cb1e90b124 100644
--- a/sql/sys_vars.cc
+++ b/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"
diff --git a/sql/table.cc b/sql/table.cc
index d624c25877f..65918dd58f9 100644
--- a/sql/table.cc
+++ b/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"
diff --git a/sql/table.h b/sql/table.h
index f626ac6ca59..34d69c585bb 100644
--- a/sql/table.h
+++ b/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"