mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#37908: Skipped access right check caused server crash.
The check_table_access function initializes per-table grant info and performs access rights check. It wasn't called for SHOW STATUS statement thus left grants info uninitialized. In some cases this led to server crash. In other cases it allowed a user to check for presence/absence of arbitrary values in any tables. Now the check_table_access function is called prior to the statement processing.
This commit is contained in:
@ -2083,13 +2083,15 @@ mysql_execute_command(THD *thd)
|
||||
#endif
|
||||
case SQLCOM_SHOW_STATUS_PROC:
|
||||
case SQLCOM_SHOW_STATUS_FUNC:
|
||||
res= execute_sqlcom_select(thd, all_tables);
|
||||
if (!(res= check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE)))
|
||||
res= execute_sqlcom_select(thd, all_tables);
|
||||
break;
|
||||
case SQLCOM_SHOW_STATUS:
|
||||
{
|
||||
system_status_var old_status_var= thd->status_var;
|
||||
thd->initial_status_var= &old_status_var;
|
||||
res= execute_sqlcom_select(thd, all_tables);
|
||||
if (!(res= check_table_access(thd, SELECT_ACL, all_tables, UINT_MAX, FALSE)))
|
||||
res= execute_sqlcom_select(thd, all_tables);
|
||||
/* Don't log SHOW STATUS commands to slow query log */
|
||||
thd->server_status&= ~(SERVER_QUERY_NO_INDEX_USED |
|
||||
SERVER_QUERY_NO_GOOD_INDEX_USED);
|
||||
|
Reference in New Issue
Block a user