mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Manual merge 5.0->5.1. Post-merge fixes.
This commit is contained in:
@ -1499,12 +1499,47 @@ bool Table_triggers_list::process_triggers(THD *thd, trg_event_type event,
|
||||
new_field= record1_field;
|
||||
old_field= table->field;
|
||||
}
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
Security_context *save_ctx;
|
||||
|
||||
if (sp_change_security_context(thd, sp_trigger, &save_ctx))
|
||||
return TRUE;
|
||||
|
||||
/*
|
||||
Fetch information about table-level privileges to GRANT_INFO structure for
|
||||
subject table. Check of privileges that will use it and information about
|
||||
column-level privileges will happen in Item_trigger_field::fix_fields().
|
||||
*/
|
||||
|
||||
fill_effective_table_privileges(thd,
|
||||
&subject_table_grants[event][time_type],
|
||||
table->s->db.str, table->s->table_name.str);
|
||||
|
||||
/* Check that the definer has TRIGGER privilege on the subject table. */
|
||||
|
||||
if (!(subject_table_grants[event][time_type].privilege & TRIGGER_ACL))
|
||||
{
|
||||
char priv_desc[128];
|
||||
get_privilege_desc(priv_desc, sizeof(priv_desc), TRIGGER_ACL);
|
||||
|
||||
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), priv_desc,
|
||||
thd->security_ctx->priv_user, thd->security_ctx->host_or_ip,
|
||||
table->s->table_name.str);
|
||||
|
||||
sp_restore_security_context(thd, save_ctx);
|
||||
return TRUE;
|
||||
}
|
||||
#endif // NO_EMBEDDED_ACCESS_CHECKS
|
||||
|
||||
thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER);
|
||||
err_status= sp_trigger->execute_trigger
|
||||
(thd, table->s->db, table->s->table_name,
|
||||
(thd, table->s->db.str, table->s->table_name.str,
|
||||
&subject_table_grants[event][time_type]);
|
||||
thd->restore_sub_statement_state(&statement_state);
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
sp_restore_security_context(thd, save_ctx);
|
||||
#endif // NO_EMBEDDED_ACCESS_CHECKS
|
||||
}
|
||||
|
||||
return err_status;
|
||||
|
Reference in New Issue
Block a user