summaryrefslogtreecommitdiff
path: root/sql/sp_head.h
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2003-12-13 16:40:52 +0100
committerunknown <pem@mysql.comhem.se>2003-12-13 16:40:52 +0100
commita6f85eeac15b520f34aed0782e10825b20a038cc (patch)
tree2412468479c77dc2c4cc6b2c28be3e07131647ef /sql/sp_head.h
parent8630ca9a098d21bfa65dd3769160c9b57844d3be (diff)
downloadmariadb-git-a6f85eeac15b520f34aed0782e10825b20a038cc.tar.gz
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.
Diffstat (limited to 'sql/sp_head.h')
-rw-r--r--sql/sp_head.h35
1 files changed, 24 insertions, 11 deletions
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 33c6bd4fe38..bf3dc012a08 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -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_ */