mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
cleanup: RAII helper for swapping of thd->security_ctx
This commit is contained in:
@ -5967,6 +5967,22 @@ class Sql_mode_save
|
||||
sql_mode_t old_mode; // SQL mode saved at construction time.
|
||||
};
|
||||
|
||||
class Switch_to_definer_security_ctx
|
||||
{
|
||||
public:
|
||||
Switch_to_definer_security_ctx(THD *thd, TABLE_LIST *table) :
|
||||
m_thd(thd), m_sctx(thd->security_ctx)
|
||||
{
|
||||
if (table->security_ctx)
|
||||
thd->security_ctx= table->security_ctx;
|
||||
}
|
||||
~Switch_to_definer_security_ctx() { m_thd->security_ctx = m_sctx; }
|
||||
|
||||
private:
|
||||
THD *m_thd;
|
||||
Security_context *m_sctx;
|
||||
};
|
||||
|
||||
#endif /* MYSQL_SERVER */
|
||||
|
||||
#endif /* SQL_CLASS_INCLUDED */
|
||||
|
Reference in New Issue
Block a user