Loading sql/mysql_priv.h +1 −1 Original line number Diff line number Diff line Loading @@ -457,7 +457,7 @@ bool check_procedure_access(THD *thd,ulong want_access,char *db,char *name, bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table); bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list); bool check_some_routine_access(THD *thd, char *db, char *name); bool check_some_routine_access(THD *thd, const char *db, const char *name); bool multi_update_precheck(THD *thd, TABLE_LIST *tables); bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count); bool mysql_multi_update_prepare(THD *thd); Loading sql/sp_head.cc +22 −14 Original line number Diff line number Diff line Loading @@ -1016,23 +1016,31 @@ sp_head::restore_thd_mem_root(THD *thd) } bool check_show_routine_acceess(THD *thd, sp_head *sp, bool *full_access) /* Check if a user has access right to a routine SYNOPSIS check_show_routine_access() thd Thread handler sp SP full_access Set to 1 if the user has SELECT right to the 'mysql.proc' able or is the owner of the routine RETURN 0 ok 1 error */ bool check_show_routine_access(THD *thd, sp_head *sp, bool *full_access) { TABLE_LIST tables; bzero((char*) &tables,sizeof(tables)); tables.db= (char*) "mysql"; tables.table_name= tables.alias= (char*) "proc"; *full_access= !check_table_access(thd, SELECT_ACL, &tables, 1); if (!(*full_access)) *full_access= (!strcmp(sp->m_definer_user.str, thd->priv_user) && !strcmp(sp->m_definer_host.str, thd->priv_host)); if (!(*full_access)) { #ifndef NO_EMBEDDED_ACCESS_CHECKS return check_some_routine_access(thd, (char * )sp->m_db.str, (char * ) sp->m_name.str); #endif } *full_access= (!check_table_access(thd, SELECT_ACL, &tables, 1) || (!strcmp(sp->m_definer_user.str, thd->priv_user) && !strcmp(sp->m_definer_host.str, thd->priv_host))); if (!*full_access) return check_some_routine_access(thd, sp->m_db.str, sp->m_name.str); return 0; } Loading @@ -1056,7 +1064,7 @@ sp_head::show_create_procedure(THD *thd) LINT_INIT(sql_mode_str); LINT_INIT(sql_mode_len); if (check_show_routine_acceess(thd, this, &full_access)) if (check_show_routine_access(thd, this, &full_access)) return 1; old_sql_mode= thd->variables.sql_mode; Loading Loading @@ -1129,7 +1137,7 @@ sp_head::show_create_function(THD *thd) LINT_INIT(sql_mode_str); LINT_INIT(sql_mode_len); if (check_show_routine_acceess(thd, this, &full_access)) if (check_show_routine_access(thd, this, &full_access)) return 1; old_sql_mode= thd->variables.sql_mode; Loading sql/sql_acl.cc +15 −3 Original line number Diff line number Diff line Loading @@ -3594,11 +3594,11 @@ bool check_grant_procedure(THD *thd, ulong want_access, name Routine name RETURN 1 error 0 Ok 1 error */ bool check_routine_level_acl(THD *thd, char *db, char *name) bool check_routine_level_acl(THD *thd, const char *db, const char *name) { bool no_routine_acl= 1; if (grant_option) Loading Loading @@ -5570,4 +5570,16 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, grant->privilege|= grant->grant_table->privs; } } #else /* NO_EMBEDDED_ACCESS_CHECKS */ /**************************************************************************** Dummy wrappers when we don't have any access checks ****************************************************************************/ bool check_routine_level_acl(THD *thd, const char *db, const char *name) { return FALSE; } #endif sql/sql_acl.h +1 −1 Original line number Diff line number Diff line Loading @@ -219,7 +219,7 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, const char *db, const char *table); bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name); bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name); bool check_routine_level_acl(THD *thd, char *db, char *name); bool check_routine_level_acl(THD *thd, const char *db, const char *name); #ifdef NO_EMBEDDED_ACCESS_CHECKS #define check_grant(A,B,C,D,E,F) 0 Loading sql/sql_parse.cc +2 −7 Original line number Diff line number Diff line Loading @@ -4760,7 +4760,7 @@ check_procedure_access(THD *thd, ulong want_access,char *db, char *name, 1 error */ bool check_some_routine_access(THD *thd, char *db, char *name) bool check_some_routine_access(THD *thd, const char *db, const char *name) { ulong save_priv; if (thd->master_access & SHOW_PROC_ACLS) Loading @@ -4768,12 +4768,7 @@ bool check_some_routine_access(THD *thd, char *db, char *name) if (!check_access(thd, SHOW_PROC_ACLS, db, &save_priv, 0, 1) || (save_priv & SHOW_PROC_ACLS)) return FALSE; #ifndef NO_EMBEDDED_ACCESS_CHECKS if (grant_option) return check_routine_level_acl(thd, db, name); #endif return FALSE; } Loading Loading
sql/mysql_priv.h +1 −1 Original line number Diff line number Diff line Loading @@ -457,7 +457,7 @@ bool check_procedure_access(THD *thd,ulong want_access,char *db,char *name, bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table); bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *table_list); bool check_some_routine_access(THD *thd, char *db, char *name); bool check_some_routine_access(THD *thd, const char *db, const char *name); bool multi_update_precheck(THD *thd, TABLE_LIST *tables); bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count); bool mysql_multi_update_prepare(THD *thd); Loading
sql/sp_head.cc +22 −14 Original line number Diff line number Diff line Loading @@ -1016,23 +1016,31 @@ sp_head::restore_thd_mem_root(THD *thd) } bool check_show_routine_acceess(THD *thd, sp_head *sp, bool *full_access) /* Check if a user has access right to a routine SYNOPSIS check_show_routine_access() thd Thread handler sp SP full_access Set to 1 if the user has SELECT right to the 'mysql.proc' able or is the owner of the routine RETURN 0 ok 1 error */ bool check_show_routine_access(THD *thd, sp_head *sp, bool *full_access) { TABLE_LIST tables; bzero((char*) &tables,sizeof(tables)); tables.db= (char*) "mysql"; tables.table_name= tables.alias= (char*) "proc"; *full_access= !check_table_access(thd, SELECT_ACL, &tables, 1); if (!(*full_access)) *full_access= (!strcmp(sp->m_definer_user.str, thd->priv_user) && !strcmp(sp->m_definer_host.str, thd->priv_host)); if (!(*full_access)) { #ifndef NO_EMBEDDED_ACCESS_CHECKS return check_some_routine_access(thd, (char * )sp->m_db.str, (char * ) sp->m_name.str); #endif } *full_access= (!check_table_access(thd, SELECT_ACL, &tables, 1) || (!strcmp(sp->m_definer_user.str, thd->priv_user) && !strcmp(sp->m_definer_host.str, thd->priv_host))); if (!*full_access) return check_some_routine_access(thd, sp->m_db.str, sp->m_name.str); return 0; } Loading @@ -1056,7 +1064,7 @@ sp_head::show_create_procedure(THD *thd) LINT_INIT(sql_mode_str); LINT_INIT(sql_mode_len); if (check_show_routine_acceess(thd, this, &full_access)) if (check_show_routine_access(thd, this, &full_access)) return 1; old_sql_mode= thd->variables.sql_mode; Loading Loading @@ -1129,7 +1137,7 @@ sp_head::show_create_function(THD *thd) LINT_INIT(sql_mode_str); LINT_INIT(sql_mode_len); if (check_show_routine_acceess(thd, this, &full_access)) if (check_show_routine_access(thd, this, &full_access)) return 1; old_sql_mode= thd->variables.sql_mode; Loading
sql/sql_acl.cc +15 −3 Original line number Diff line number Diff line Loading @@ -3594,11 +3594,11 @@ bool check_grant_procedure(THD *thd, ulong want_access, name Routine name RETURN 1 error 0 Ok 1 error */ bool check_routine_level_acl(THD *thd, char *db, char *name) bool check_routine_level_acl(THD *thd, const char *db, const char *name) { bool no_routine_acl= 1; if (grant_option) Loading Loading @@ -5570,4 +5570,16 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, grant->privilege|= grant->grant_table->privs; } } #else /* NO_EMBEDDED_ACCESS_CHECKS */ /**************************************************************************** Dummy wrappers when we don't have any access checks ****************************************************************************/ bool check_routine_level_acl(THD *thd, const char *db, const char *name) { return FALSE; } #endif
sql/sql_acl.h +1 −1 Original line number Diff line number Diff line Loading @@ -219,7 +219,7 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, const char *db, const char *table); bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name); bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name); bool check_routine_level_acl(THD *thd, char *db, char *name); bool check_routine_level_acl(THD *thd, const char *db, const char *name); #ifdef NO_EMBEDDED_ACCESS_CHECKS #define check_grant(A,B,C,D,E,F) 0 Loading
sql/sql_parse.cc +2 −7 Original line number Diff line number Diff line Loading @@ -4760,7 +4760,7 @@ check_procedure_access(THD *thd, ulong want_access,char *db, char *name, 1 error */ bool check_some_routine_access(THD *thd, char *db, char *name) bool check_some_routine_access(THD *thd, const char *db, const char *name) { ulong save_priv; if (thd->master_access & SHOW_PROC_ACLS) Loading @@ -4768,12 +4768,7 @@ bool check_some_routine_access(THD *thd, char *db, char *name) if (!check_access(thd, SHOW_PROC_ACLS, db, &save_priv, 0, 1) || (save_priv & SHOW_PROC_ACLS)) return FALSE; #ifndef NO_EMBEDDED_ACCESS_CHECKS if (grant_option) return check_routine_level_acl(thd, db, name); #endif return FALSE; } Loading