diff options
author | unknown <anozdrin@mysql.com> | 2006-01-24 20:15:12 +0300 |
---|---|---|
committer | unknown <anozdrin@mysql.com> | 2006-01-24 20:15:12 +0300 |
commit | 8f395ebbfa87f21cb7acf655876790df99389499 (patch) | |
tree | 8b864c683f6cc00900b0bf9a6b84bc78cb1cf3e8 /sql/sql_trigger.h | |
parent | 9e0240d3661bd746a14eaa23531a2ccbab48f1ab (diff) | |
download | mariadb-git-8f395ebbfa87f21cb7acf655876790df99389499.tar.gz |
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.
Diffstat (limited to 'sql/sql_trigger.h')
-rw-r--r-- | sql/sql_trigger.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 51002683897..8992de63b37 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -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; |