mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
WL#1365: Implement definer's rights execution of stored procedures.
(Also put the hostpart back in the definer column.) mysql-test/r/sp-error.result: Moved error test from sp.test mysql-test/r/sp.result: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. mysql-test/t/sp-error.test: Moved error test from sp.test mysql-test/t/sp.test: Moved error test to sp-error.test. Put hostpart back into definer column in mysql.proc. sql/item_func.cc: (Maybe) switch security context before invoking a stored function. sql/sp.cc: Renamed creator into definer, for more consistent terminology, and put the hostpart back. sql/sp_head.cc: Some fixes in the way things are allocated, and moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sp_head.h: Moved set_info() definition here from sp_head.h. creator is now called definer, and is split into a user and host part. Added functions for (possible) change and restore of privileges, for sql security definer calls. sql/sql_acl.cc: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_acl.h: New function acl_getroot_no_password() for getting the privileges used when calling an SP with sql security definer. sql/sql_parse.cc: (Maybe) switch security context before invoking a stored procedure. sql/sql_yacc.yy: Fixed typo.
This commit is contained in:
@@ -61,8 +61,8 @@ public:
|
||||
LEX_STRING m_retstr; // For FUNCTIONs only
|
||||
LEX_STRING m_body;
|
||||
LEX_STRING m_defstr;
|
||||
char *m_creator;
|
||||
uint m_creatorlen;
|
||||
LEX_STRING m_definer_user;
|
||||
LEX_STRING m_definer_host;
|
||||
longlong m_created;
|
||||
longlong m_modified;
|
||||
// Pointers set during parsing
|
||||
@@ -159,16 +159,9 @@ public:
|
||||
return sp_map_result_type(m_returns);
|
||||
}
|
||||
|
||||
void set_info(char *creator, uint creatorlen,
|
||||
void set_info(char *definer, uint definerlen,
|
||||
longlong created, longlong modified,
|
||||
st_sp_chistics *chistics)
|
||||
{
|
||||
m_creator= creator;
|
||||
m_creatorlen= creatorlen;
|
||||
m_created= created;
|
||||
m_modified= modified;
|
||||
m_chistics= chistics;
|
||||
}
|
||||
st_sp_chistics *chistics);
|
||||
|
||||
inline void reset_thd_mem_root(THD *thd)
|
||||
{
|
||||
@@ -642,4 +635,24 @@ private:
|
||||
}; // class sp_instr_cfetch : public sp_instr
|
||||
|
||||
|
||||
struct st_sp_security_context
|
||||
{
|
||||
bool changed;
|
||||
uint master_access;
|
||||
uint db_access;
|
||||
char *db;
|
||||
uint db_length;
|
||||
char *priv_user;
|
||||
char priv_host[MAX_HOSTNAME];
|
||||
char *user;
|
||||
char *host;
|
||||
char *ip;
|
||||
};
|
||||
|
||||
void
|
||||
sp_change_security_context(THD *thd, sp_head *sp, st_sp_security_context *ctxp);
|
||||
|
||||
void
|
||||
sp_restore_security_context(THD *thd, sp_head *sp,st_sp_security_context *ctxp);
|
||||
|
||||
#endif /* _SP_HEAD_H_ */
|
||||
|
||||
Reference in New Issue
Block a user