Merge quad.:/mnt/raid/alik/MySQL/devel/5.1
into quad.:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
This commit is contained in:
commit
1852fb971e
@ -1623,4 +1623,19 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
|
||||
show events where Db= 'information_schema';
|
||||
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
|
||||
use test;
|
||||
#
|
||||
# Bug#34166: Server crash in SHOW OPEN TABLES and prelocking
|
||||
#
|
||||
drop table if exists t1;
|
||||
drop function if exists f1;
|
||||
create table t1 (a int);
|
||||
create function f1() returns int
|
||||
begin
|
||||
insert into t1 (a) values (1);
|
||||
return 0;
|
||||
end|
|
||||
show open tables where f1()=0;
|
||||
show open tables where f1()=0;
|
||||
drop table t1;
|
||||
drop function f1;
|
||||
End of 5.1 tests.
|
||||
|
@ -143,4 +143,14 @@ connection: default
|
||||
flush tables;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (a int);
|
||||
flush status;
|
||||
lock tables t1 read;
|
||||
insert into t1 values(1);;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
select @tlwa < @tlwb;
|
||||
@tlwa < @tlwb
|
||||
1
|
||||
End of 5.1 tests
|
||||
|
@ -1248,4 +1248,26 @@ show events from information_schema;
|
||||
show events where Db= 'information_schema';
|
||||
use test;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#34166: Server crash in SHOW OPEN TABLES and prelocking
|
||||
--echo #
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop function if exists f1;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
delimiter |;
|
||||
create function f1() returns int
|
||||
begin
|
||||
insert into t1 (a) values (1);
|
||||
return 0;
|
||||
end|
|
||||
delimiter ;|
|
||||
--disable_result_log
|
||||
show open tables where f1()=0;
|
||||
show open tables where f1()=0;
|
||||
--enable_result_log
|
||||
drop table t1;
|
||||
drop function f1;
|
||||
|
||||
--echo End of 5.1 tests.
|
||||
|
@ -439,4 +439,35 @@ connection default;
|
||||
disconnect flush;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#30331: Table_locks_waited shows inaccurate values
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int);
|
||||
flush status;
|
||||
lock tables t1 read;
|
||||
let $tlwa= `show status like 'Table_locks_waited'`;
|
||||
connect (waiter,localhost,root,,);
|
||||
connection waiter;
|
||||
--send insert into t1 values(1);
|
||||
connection default;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and info = "insert into t1 values(1)";
|
||||
--source include/wait_condition.inc
|
||||
let $tlwb= `show status like 'Table_locks_waited'`;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
disconnect waiter;
|
||||
connection default;
|
||||
--disable_query_log
|
||||
eval SET @tlwa= SUBSTRING_INDEX('$tlwa', ' ', -1);
|
||||
eval SET @tlwb= SUBSTRING_INDEX('$tlwb', ' ', -1);
|
||||
--enable_query_log
|
||||
select @tlwa < @tlwb;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -141,10 +141,10 @@ set GLOBAL myisam_max_sort_file_size=2000000;
|
||||
show global variables like 'myisam_max_sort_file_size';
|
||||
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
|
||||
set GLOBAL myisam_max_sort_file_size=default;
|
||||
--replace_result 9223372036853727232 FILE_SIZE 2146435072 FILE_SIZE
|
||||
--replace_result 2147483647 FILE_SIZE 9223372036853727232 FILE_SIZE
|
||||
show global variables like 'myisam_max_sort_file_size';
|
||||
--replace_result 9223372036853727232 FILE_SIZE 2146435072 FILE_SIZE
|
||||
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
|
||||
--replace_result 2147483647 FILE_SIZE 9223372036853727232 FILE_SIZE
|
||||
select * from information_schema.session_variables where variable_name like 'myisam_max_sort_file_size';
|
||||
|
||||
set global net_retry_count=10, session net_retry_count=10;
|
||||
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
|
||||
|
@ -405,6 +405,8 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
|
||||
wait->last= &data->next;
|
||||
}
|
||||
|
||||
statistic_increment(locks_waited, &THR_LOCK_lock);
|
||||
|
||||
/* Set up control struct to allow others to abort locks */
|
||||
thread_var->current_mutex= &data->lock->mutex;
|
||||
thread_var->current_cond= cond;
|
||||
@ -469,7 +471,6 @@ wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
|
||||
else
|
||||
{
|
||||
result= THR_LOCK_SUCCESS;
|
||||
statistic_increment(locks_waited, &THR_LOCK_lock);
|
||||
if (data->lock->get_status)
|
||||
(*data->lock->get_status)(data->status_param, 0);
|
||||
check_locks(data->lock,"got wait_for_lock",0);
|
||||
|
@ -1034,7 +1034,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
|
||||
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);
|
||||
uint number, bool no_errors);
|
||||
bool check_global_access(THD *thd, ulong want_access);
|
||||
#else
|
||||
inline bool check_access(THD *thd, ulong access, const char *db,
|
||||
@ -1046,7 +1046,7 @@ inline bool check_access(THD *thd, ulong access, const char *db,
|
||||
return false;
|
||||
}
|
||||
inline bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
|
||||
bool no_errors)
|
||||
uint number, bool no_errors)
|
||||
{ return false; }
|
||||
inline bool check_global_access(THD *thd, ulong want_access)
|
||||
{ return false; }
|
||||
|
@ -2309,7 +2309,7 @@ bool check_show_routine_access(THD *thd, sp_head *sp, bool *full_access)
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.db= (char*) "mysql";
|
||||
tables.table_name= tables.alias= (char*) "proc";
|
||||
*full_access= (!check_table_access(thd, SELECT_ACL, &tables, 1) ||
|
||||
*full_access= (!check_table_access(thd, SELECT_ACL, &tables, 1, TRUE) ||
|
||||
(!strcmp(sp->m_definer_user.str,
|
||||
thd->security_ctx->priv_user) &&
|
||||
!strcmp(sp->m_definer_host.str,
|
||||
@ -2753,7 +2753,7 @@ int sp_instr::exec_open_and_lock_tables(THD *thd, TABLE_LIST *tables)
|
||||
Check whenever we have access to tables for this statement
|
||||
and open and lock them before executing instructions core function.
|
||||
*/
|
||||
if (check_table_access(thd, SELECT_ACL, tables, 0)
|
||||
if (check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE)
|
||||
|| open_and_lock_tables(thd, tables))
|
||||
result= -1;
|
||||
else
|
||||
|
@ -3862,7 +3862,7 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
|
||||
of other queries). For simple queries first_not_own_table is 0.
|
||||
*/
|
||||
for (i= 0, table= tables;
|
||||
table != first_not_own_table && i < number;
|
||||
i < number && table != first_not_own_table;
|
||||
table= table->next_global, i++)
|
||||
{
|
||||
/* Remove SHOW_VIEW_ACL, because it will be checked during making view */
|
||||
|
@ -799,7 +799,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild)
|
||||
table_list.table_name= share->table_name.str;
|
||||
table_list.grant.privilege=0;
|
||||
|
||||
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list,1))
|
||||
if (check_table_access(thd,SELECT_ACL | EXTRA_ACL,&table_list, 1, TRUE))
|
||||
continue;
|
||||
/* need to check if we haven't already listed it */
|
||||
for (table= open_list ; table ; table=table->next)
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
my_bool is_clear_all() const { return bitmap_is_clear_all(&map); }
|
||||
my_bool is_set_all() const { return bitmap_is_set_all(&map); }
|
||||
my_bool is_subset(const Bitmap& map2) const { return bitmap_is_subset(&map, &map2.map); }
|
||||
my_bool is_overlapping(const Bitmap& map2) const { return bitmap_is_overlapping(&map, map2.map); }
|
||||
my_bool is_overlapping(const Bitmap& map2) const { return bitmap_is_overlapping(&map, &map2.map); }
|
||||
my_bool operator==(const Bitmap& map2) const { return bitmap_cmp(&map, &map2.map); }
|
||||
char *print(char *buf) const
|
||||
{
|
||||
|
@ -1384,7 +1384,7 @@ def_week_frmt: %lu",
|
||||
table_list.db = table->db();
|
||||
table_list.alias= table_list.table_name= table->table();
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (check_table_access(thd,SELECT_ACL,&table_list,1))
|
||||
if (check_table_access(thd,SELECT_ACL,&table_list, 1, TRUE))
|
||||
{
|
||||
DBUG_PRINT("qcache",
|
||||
("probably no SELECT access to %s.%s => return to normal processing",
|
||||
|
@ -503,7 +503,7 @@ static bool check_merge_table_access(THD *thd, char *db,
|
||||
tlist->db= db; /* purecov: inspected */
|
||||
}
|
||||
error= check_table_access(thd, SELECT_ACL | UPDATE_ACL | DELETE_ACL,
|
||||
table_list,0);
|
||||
table_list, UINT_MAX, FALSE);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
@ -2047,7 +2047,7 @@ mysql_execute_command(THD *thd)
|
||||
res= check_table_access(thd,
|
||||
lex->exchange ? SELECT_ACL | FILE_ACL :
|
||||
SELECT_ACL,
|
||||
all_tables, 0);
|
||||
all_tables, UINT_MAX, FALSE);
|
||||
}
|
||||
else
|
||||
res= check_access(thd,
|
||||
@ -2072,7 +2072,7 @@ mysql_execute_command(THD *thd)
|
||||
break;
|
||||
}
|
||||
case SQLCOM_DO:
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, 0) ||
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
open_and_lock_tables(thd, all_tables))
|
||||
goto error;
|
||||
|
||||
@ -2182,7 +2182,7 @@ mysql_execute_command(THD *thd)
|
||||
case SQLCOM_BACKUP_TABLE:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, 0) ||
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
check_global_access(thd, FILE_ACL))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
@ -2194,7 +2194,7 @@ mysql_execute_command(THD *thd)
|
||||
case SQLCOM_RESTORE_TABLE:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, INSERT_ACL, all_tables, 0) ||
|
||||
if (check_table_access(thd, INSERT_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
check_global_access(thd, FILE_ACL))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
@ -2743,7 +2743,8 @@ end_with_restore_list:
|
||||
case SQLCOM_CHECKSUM:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL | EXTRA_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL | EXTRA_ACL, all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
res = mysql_checksum_table(thd, first_table, &lex->check_opt);
|
||||
break;
|
||||
@ -2751,7 +2752,8 @@ end_with_restore_list:
|
||||
case SQLCOM_REPAIR:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
res= mysql_repair_table(thd, first_table, &lex->check_opt);
|
||||
@ -2770,7 +2772,8 @@ end_with_restore_list:
|
||||
case SQLCOM_CHECK:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL | EXTRA_ACL , all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL | EXTRA_ACL , all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
res = mysql_check_table(thd, first_table, &lex->check_opt);
|
||||
@ -2781,7 +2784,8 @@ end_with_restore_list:
|
||||
case SQLCOM_ANALYZE:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
res= mysql_analyze_table(thd, first_table, &lex->check_opt);
|
||||
@ -2801,7 +2805,8 @@ end_with_restore_list:
|
||||
case SQLCOM_OPTIMIZE:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
thd->enable_slow_log= opt_log_slow_admin_statements;
|
||||
res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ?
|
||||
@ -3130,7 +3135,7 @@ end_with_restore_list:
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (!lex->drop_temporary)
|
||||
{
|
||||
if (check_table_access(thd, DROP_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, DROP_ACL, all_tables, UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
if (end_active_trans(thd))
|
||||
goto error;
|
||||
@ -3234,7 +3239,7 @@ end_with_restore_list:
|
||||
if (lex->autocommit && end_active_trans(thd))
|
||||
goto error;
|
||||
|
||||
if ((check_table_access(thd, SELECT_ACL, all_tables, 0) ||
|
||||
if ((check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
open_and_lock_tables(thd, all_tables)))
|
||||
goto error;
|
||||
if (lex->one_shot_set && not_all_support_one_shot(lex_var_list))
|
||||
@ -3276,7 +3281,8 @@ end_with_restore_list:
|
||||
/* we must end the trasaction first, regardless of anything */
|
||||
if (end_active_trans(thd))
|
||||
goto error;
|
||||
if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables,
|
||||
UINT_MAX, FALSE))
|
||||
goto error;
|
||||
thd->in_lock_tables=1;
|
||||
thd->options|= OPTION_TABLE_LOCK;
|
||||
@ -3770,7 +3776,7 @@ end_with_restore_list:
|
||||
#endif
|
||||
case SQLCOM_HA_OPEN:
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE))
|
||||
goto error;
|
||||
res= mysql_ha_open(thd, first_table, 0);
|
||||
break;
|
||||
@ -4018,7 +4024,7 @@ create_sp_error:
|
||||
This will cache all SP and SF and open and lock all tables
|
||||
required for execution.
|
||||
*/
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, 0) ||
|
||||
if (check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
open_and_lock_tables(thd, all_tables))
|
||||
goto error;
|
||||
|
||||
@ -4365,7 +4371,7 @@ create_sp_error:
|
||||
}
|
||||
case SQLCOM_DROP_VIEW:
|
||||
{
|
||||
if (check_table_access(thd, DROP_ACL, all_tables, 0) ||
|
||||
if (check_table_access(thd, DROP_ACL, all_tables, UINT_MAX, FALSE) ||
|
||||
end_active_trans(thd))
|
||||
goto error;
|
||||
/* Conditionally writes to binlog. */
|
||||
@ -4841,7 +4847,7 @@ bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
|
||||
subselects_tables= subselects_tables->next_global;
|
||||
}
|
||||
if (subselects_tables &&
|
||||
(check_table_access(thd, SELECT_ACL, subselects_tables, 0)))
|
||||
(check_table_access(thd, SELECT_ACL, subselects_tables, UINT_MAX, FALSE)))
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -5075,11 +5081,12 @@ static bool check_show_access(THD *thd, TABLE_LIST *table)
|
||||
/**
|
||||
Check the privilege for all used tables.
|
||||
|
||||
@param thd Thread context
|
||||
@param want_access Privileges requested
|
||||
@param tables List of tables to be checked
|
||||
@param no_errors FALSE/TRUE - report/don't report error to
|
||||
the client (using my_error() call).
|
||||
@param thd Thread context
|
||||
@param want_access Privileges requested
|
||||
@param tables List of tables to be checked
|
||||
@param number Check at most this number of tables.
|
||||
@param no_errors FALSE/TRUE - report/don't report error to
|
||||
the client (using my_error() call).
|
||||
|
||||
@note
|
||||
Table privileges are cached in the table list for GRANT checking.
|
||||
@ -5088,25 +5095,25 @@ static bool check_show_access(THD *thd, TABLE_LIST *table)
|
||||
(the latter should be either 0 or point to next_global member
|
||||
of one of elements of this table list).
|
||||
|
||||
@retval
|
||||
FALSE OK
|
||||
@retval
|
||||
TRUE Access denied
|
||||
@retval FALSE OK
|
||||
@retval TRUE Access denied
|
||||
*/
|
||||
|
||||
bool
|
||||
check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
|
||||
bool no_errors)
|
||||
uint number, bool no_errors)
|
||||
{
|
||||
TABLE_LIST *org_tables= tables;
|
||||
TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
|
||||
uint i= 0;
|
||||
Security_context *sctx= thd->security_ctx, *backup_ctx= thd->security_ctx;
|
||||
/*
|
||||
The check that first_not_own_table is not reached is for the case when
|
||||
the given table list refers to the list for prelocking (contains tables
|
||||
of other queries). For simple queries first_not_own_table is 0.
|
||||
*/
|
||||
for (; tables != first_not_own_table; tables= tables->next_global)
|
||||
for (; i < number && tables != first_not_own_table;
|
||||
tables= tables->next_global, i++)
|
||||
{
|
||||
if (tables->security_ctx)
|
||||
sctx= tables->security_ctx;
|
||||
@ -5156,7 +5163,7 @@ check_table_access(THD *thd, ulong want_access,TABLE_LIST *tables,
|
||||
}
|
||||
thd->security_ctx= backup_ctx;
|
||||
return check_grant(thd,want_access & ~EXTRA_ACL,org_tables,
|
||||
test(want_access & EXTRA_ACL), UINT_MAX, no_errors);
|
||||
test(want_access & EXTRA_ACL), number, no_errors);
|
||||
deny:
|
||||
thd->security_ctx= backup_ctx;
|
||||
return TRUE;
|
||||
@ -6885,7 +6892,7 @@ bool multi_delete_precheck(THD *thd, TABLE_LIST *tables)
|
||||
|
||||
/* sql_yacc guarantees that tables and aux_tables are not zero */
|
||||
DBUG_ASSERT(aux_tables != 0);
|
||||
if (check_table_access(thd, SELECT_ACL, tables, 0))
|
||||
if (check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/*
|
||||
@ -6894,7 +6901,7 @@ bool multi_delete_precheck(THD *thd, TABLE_LIST *tables)
|
||||
call check_table_access() safely.
|
||||
*/
|
||||
thd->lex->query_tables_own_last= 0;
|
||||
if (check_table_access(thd, DELETE_ACL, aux_tables, 0))
|
||||
if (check_table_access(thd, DELETE_ACL, aux_tables, UINT_MAX, FALSE))
|
||||
{
|
||||
thd->lex->query_tables_own_last= save_query_tables_own_last;
|
||||
DBUG_RETURN(TRUE);
|
||||
@ -7133,7 +7140,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables,0))
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE))
|
||||
goto err;
|
||||
}
|
||||
else if (lex->create_info.options & HA_LEX_CREATE_TABLE_LIKE)
|
||||
|
@ -1619,7 +1619,7 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl
|
||||
bzero(&tables, sizeof(tables));
|
||||
tables.db= (char *)"mysql";
|
||||
tables.table_name= tables.alias= (char *)"plugin";
|
||||
if (check_table_access(thd, INSERT_ACL, &tables, 0))
|
||||
if (check_table_access(thd, INSERT_ACL, &tables, 1, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/* need to open before acquiring LOCK_plugin or it will deadlock */
|
||||
|
@ -1280,7 +1280,7 @@ static int mysql_test_select(Prepared_statement *stmt,
|
||||
ulong privilege= lex->exchange ? SELECT_ACL | FILE_ACL : SELECT_ACL;
|
||||
if (tables)
|
||||
{
|
||||
if (check_table_access(thd, privilege, tables,0))
|
||||
if (check_table_access(thd, privilege, tables, UINT_MAX, FALSE))
|
||||
goto error;
|
||||
}
|
||||
else if (check_access(thd, privilege, any_db,0,0,0,0))
|
||||
@ -1349,7 +1349,7 @@ static bool mysql_test_do_fields(Prepared_statement *stmt,
|
||||
THD *thd= stmt->thd;
|
||||
|
||||
DBUG_ENTER("mysql_test_do_fields");
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, 0))
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (open_normal_and_derived_tables(thd, tables, 0))
|
||||
@ -1380,7 +1380,7 @@ static bool mysql_test_set_fields(Prepared_statement *stmt,
|
||||
THD *thd= stmt->thd;
|
||||
set_var_base *var;
|
||||
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, 0) ||
|
||||
if (tables && check_table_access(thd, SELECT_ACL, tables, UINT_MAX, FALSE) ||
|
||||
open_normal_and_derived_tables(thd, tables, 0))
|
||||
goto error;
|
||||
|
||||
|
@ -4059,7 +4059,7 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
proc_tables.table_name= proc_tables.alias= (char*) "proc";
|
||||
proc_tables.table_name_length= 4;
|
||||
proc_tables.lock_type= TL_READ;
|
||||
full_access= !check_table_access(thd, SELECT_ACL, &proc_tables, 1);
|
||||
full_access= !check_table_access(thd, SELECT_ACL, &proc_tables, 1, TRUE);
|
||||
if (!(proc_table= open_proc_table_for_read(thd, &open_tables_state_backup)))
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
@ -4447,10 +4447,8 @@ static int get_schema_triggers_record(THD *thd, TABLE_LIST *tables,
|
||||
Table_triggers_list *triggers= tables->table->triggers;
|
||||
int event, timing;
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
if (check_table_access(thd, TRIGGER_ACL, tables, 1))
|
||||
if (check_table_access(thd, TRIGGER_ACL, tables, 1, TRUE))
|
||||
goto ret;
|
||||
#endif
|
||||
|
||||
for (event= 0; event < (int)TRG_EVENT_MAX; event++)
|
||||
{
|
||||
@ -4488,9 +4486,7 @@ static int get_schema_triggers_record(THD *thd, TABLE_LIST *tables,
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
ret:
|
||||
#endif
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
|
||||
TABLE_LIST **save_query_tables_own_last= thd->lex->query_tables_own_last;
|
||||
thd->lex->query_tables_own_last= 0;
|
||||
|
||||
err_status= check_table_access(thd, TRIGGER_ACL, tables, 0);
|
||||
err_status= check_table_access(thd, TRIGGER_ACL, tables, 1, FALSE);
|
||||
|
||||
thd->lex->query_tables_own_last= save_query_tables_own_last;
|
||||
|
||||
|
@ -1123,8 +1123,8 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
||||
if (!table->prelocking_placeholder &&
|
||||
(old_lex->sql_command == SQLCOM_SELECT && old_lex->describe))
|
||||
{
|
||||
if (check_table_access(thd, SELECT_ACL, view_tables, 1) &&
|
||||
check_table_access(thd, SHOW_VIEW_ACL, table, 1))
|
||||
if (check_table_access(thd, SELECT_ACL, view_tables, UINT_MAX, TRUE) &&
|
||||
check_table_access(thd, SHOW_VIEW_ACL, table, UINT_MAX, TRUE))
|
||||
{
|
||||
my_message(ER_VIEW_NO_EXPLAIN, ER(ER_VIEW_NO_EXPLAIN), MYF(0));
|
||||
goto err;
|
||||
@ -1134,7 +1134,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
|
||||
(old_lex->sql_command == SQLCOM_SHOW_CREATE) &&
|
||||
!table->belong_to_view)
|
||||
{
|
||||
if (check_table_access(thd, SHOW_VIEW_ACL, table, 0))
|
||||
if (check_table_access(thd, SHOW_VIEW_ACL, table, UINT_MAX, FALSE))
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user