MDEV-5553 A view or procedure with a non existing definer can block "SHOW TABLE STATUS" with an unclear error message

Don't double-check privileges for a column in the GROUP BY that refers to
the same column in SELECT clause. Privileges were already checked for SELECT clause.
This commit is contained in:
Sergei Golubchik 2014-10-07 11:55:39 +02:00
parent e5bc21af37
commit fc58ba6c76
3 changed files with 25 additions and 1 deletions

View file

@ -0,0 +1,13 @@
create database mysqltest1;
use mysqltest1;
create table t1(id int primary key);
create definer=unknownuser@'%' sql security definer view v1 as select t1.id from t1 group by t1.id;
Warnings:
Note 1449 The user specified as a definer ('unknownuser'@'%') does not exist
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW
Warnings:
Note 1449 The user specified as a definer ('unknownuser'@'%') does not exist
drop database mysqltest1;

View file

@ -0,0 +1,11 @@
#
# MDEV-5553 A view or procedure with a non existing definer can block "SHOW TABLE STATUS" with an unclear error message
#
create database mysqltest1; # all-open privileges on test db desroy the test
use mysqltest1;
create table t1(id int primary key);
create definer=unknownuser@'%' sql security definer view v1 as select t1.id from t1 group by t1.id;
--replace_column 8 # 12 # 13 #
show table status;
drop database mysqltest1;

View file

@ -20458,7 +20458,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
order_item_type == Item::REF_ITEM)
{
from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables,
NULL, &view_ref, IGNORE_ERRORS, TRUE,
NULL, &view_ref, IGNORE_ERRORS, FALSE,
FALSE);
if (!from_field)
from_field= (Field*) not_found_field;