MCPcopy Create free account
hub / github.com/MariaDB/server / check_routine_access

Function check_routine_access

sql/sql_parse.cc:7086–7119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7084
7085
7086bool
7087check_routine_access(THD *thd, privilege_t want_access, const LEX_CSTRING *db,
7088 const LEX_CSTRING *name,
7089 const Sp_handler *sph, bool no_errors)
7090{
7091 TABLE_LIST tables[1];
7092
7093 bzero((char *)tables, sizeof(TABLE_LIST));
7094 tables->db= Lex_ident_db(*db);
7095 tables->table_name= tables->alias= Lex_ident_table(*name);
7096
7097 /*
7098 The following test is just a shortcut for check_access() (to avoid
7099 calculating db_access) under the assumption that it's common to
7100 give persons global right to execute all stored SP (but not
7101 necessary to create them).
7102 Note that this effectively bypasses the ACL_internal_schema_access checks
7103 that are implemented for the INFORMATION_SCHEMA and PERFORMANCE_SCHEMA,
7104 which are located in check_access().
7105 Since the I_S and P_S do not contain routines, this bypass is ok,
7106 as long as this code path is not abused to create routines.
7107 The assert enforce that.
7108 */
7109 DBUG_ASSERT((want_access & CREATE_PROC_ACL) == NO_ACL);
7110 if ((thd->security_ctx->master_access & want_access) == want_access)
7111 tables->grant.privilege= want_access;
7112 else if (check_access(thd, want_access, db->str,
7113 &tables->grant.privilege,
7114 &tables->grant.m_internal,
7115 0, no_errors))
7116 return TRUE;
7117
7118 return check_grant_routine(thd, want_access, tables, sph, no_errors);
7119}
7120
7121
7122/**

Callers 4

mysql_create_routineFunction · 0.70
executeMethod · 0.70
alter_routineFunction · 0.70
drop_routineFunction · 0.70

Calls 4

Lex_ident_dbClass · 0.85
Lex_ident_tableClass · 0.85
check_grant_routineFunction · 0.85
check_accessFunction · 0.70

Tested by

no test coverage detected