mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix for the following bugs:
- BUG#15166: Wrong update permissions required to execute triggers - BUG#15196: Wrong select permission required to execute triggers The idea of the fix is to check necessary privileges in Item_trigger_field::fix_fields(), instead of having "special variables" technique. To achieve this, we should pass to an Item_trigger_field instance a flag, which will indicate the usage/access type of this trigger variable. mysql-test/r/trigger-grant.result: Update the result file. mysql-test/t/trigger-grant.test: Add test cases for BUG#15166 and BUG#15196 sql/item.cc: Item_trigger_field: check appropriate (SELECT/UPDATE) privilege in fix_fields(). sql/item.h: Add a flag to specify access type for trigger field. sql/sql_trigger.cc: "Special variable" technique of checking privileges for NEW/OLD variables was replaced by checking table- and column-level privileges in Item_trigger_field::fix_fields(). sql/sql_trigger.h: "Special variable" technique of checking privileges for NEW/OLD variables was replaced by checking table- and column-level privileges in Item_trigger_field::fix_fields(). sql/sql_yacc.yy: Specify access type for trigger fields.
This commit is contained in:
@ -56,10 +56,9 @@ class Table_triggers_list: public Sql_alloc
|
||||
LEX_STRING sroutines_key;
|
||||
|
||||
/*
|
||||
is_special_var_used specifies whether trigger body contains special
|
||||
variables (NEW/OLD).
|
||||
Grant information for each trigger (pair: subject table, trigger definer).
|
||||
*/
|
||||
bool m_spec_var_used[TRG_EVENT_MAX][TRG_ACTION_MAX];
|
||||
GRANT_INFO subject_table_grants[TRG_EVENT_MAX][TRG_ACTION_MAX];
|
||||
|
||||
public:
|
||||
/*
|
||||
@ -78,6 +77,7 @@ public:
|
||||
record1_field(0), table(table_arg)
|
||||
{
|
||||
bzero((char *)bodies, sizeof(bodies));
|
||||
bzero((char *)&subject_table_grants, sizeof(subject_table_grants));
|
||||
}
|
||||
~Table_triggers_list();
|
||||
|
||||
@ -109,11 +109,6 @@ public:
|
||||
return test(bodies[TRG_EVENT_UPDATE][TRG_ACTION_BEFORE]);
|
||||
}
|
||||
|
||||
inline bool is_special_var_used(int event, int action_time) const
|
||||
{
|
||||
return m_spec_var_used[event][action_time];
|
||||
}
|
||||
|
||||
void set_table(TABLE *new_table);
|
||||
|
||||
friend class Item_trigger_field;
|
||||
|
Reference in New Issue
Block a user