Loading mysql-test/r/partition_grant.result +10 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,16 @@ revoke alter on mysqltest_1.* from mysqltest_1@localhost; alter table t1 drop partition p3; ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop table t1; create table t1 (s1 int); insert into t1 values (1); grant alter on mysqltest_1.* to mysqltest_1@localhost; alter table t1 partition by list (s1) (partition p1 values in (2)); ERROR HY000: Table has no partition for some existing values grant select, alter on mysqltest_1.* to mysqltest_1@localhost; alter table t1 partition by list (s1) (partition p1 values in (2)); ERROR HY000: Table has no partition for value 1 drop table t1; drop user mysqltest_1@localhost; drop schema mysqltest_1; End of 5.1 tests mysql-test/t/partition_grant.test +23 −1 Original line number Diff line number Diff line Loading @@ -52,8 +52,30 @@ disconnect conn3; connection default; revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop table t1; # # Bug #23675 Partitions: possible security breach via alter # create table t1 (s1 int); insert into t1 values (1); grant alter on mysqltest_1.* to mysqltest_1@localhost; connect (conn4,localhost,mysqltest_1,,mysqltest_1); connection conn4; --error 1514 alter table t1 partition by list (s1) (partition p1 values in (2)); connection default; grant select, alter on mysqltest_1.* to mysqltest_1@localhost; disconnect conn4; connect (conn5,localhost,mysqltest_1,,mysqltest_1); --error 1514 alter table t1 partition by list (s1) (partition p1 values in (2)); disconnect conn5; connection default; drop table t1; drop user mysqltest_1@localhost; drop schema mysqltest_1; --echo End of 5.1 tests sql/mysql_priv.h +1 −1 Original line number Diff line number Diff line Loading @@ -599,7 +599,7 @@ class THD; void close_thread_tables(THD *thd, bool locked=0, bool skip_derived=0); bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables); bool check_single_table_access(THD *thd, ulong privilege, TABLE_LIST *tables); TABLE_LIST *tables, bool no_errors); bool check_routine_access(THD *thd,ulong want_access,char *db,char *name, bool is_proc, bool no_errors); bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table); Loading sql/partition_info.cc +19 −7 Original line number Diff line number Diff line Loading @@ -849,8 +849,19 @@ void partition_info::print_no_partition_found(TABLE *table) { char buf[100]; char *buf_ptr= (char*)&buf; my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set); TABLE_LIST table_list; bzero(&table_list, sizeof(table_list)); table_list.db= table->s->db.str; table_list.table_name= table->s->table_name.str; if (check_single_table_access(current_thd, SELECT_ACL, &table_list, TRUE)) my_message(ER_NO_PARTITION_FOR_GIVEN_VALUE, ER(ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT), MYF(0)); else { my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set); if (part_expr->null_value) buf_ptr= (char*)"NULL"; else Loading @@ -859,6 +870,7 @@ void partition_info::print_no_partition_found(TABLE *table) my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, MYF(0), buf_ptr); dbug_tmp_restore_column_map(table->read_set, old_map); } } /* Set up buffers and arrays for fields requiring preparation SYNOPSIS Loading sql/share/errmsg.txt +2 −0 Original line number Diff line number Diff line Loading @@ -6057,3 +6057,5 @@ ER_EVENT_CANNOT_ALTER_IN_THE_PAST eng "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been altered" ER_SLAVE_INCIDENT eng "The incident %s occured on the master. Message: %-.64s" ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT eng "Table has no partition for some existing values" Loading
mysql-test/r/partition_grant.result +10 −1 Original line number Diff line number Diff line Loading @@ -19,7 +19,16 @@ revoke alter on mysqltest_1.* from mysqltest_1@localhost; alter table t1 drop partition p3; ERROR 42000: ALTER command denied to user 'mysqltest_1'@'localhost' for table 't1' revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop table t1; create table t1 (s1 int); insert into t1 values (1); grant alter on mysqltest_1.* to mysqltest_1@localhost; alter table t1 partition by list (s1) (partition p1 values in (2)); ERROR HY000: Table has no partition for some existing values grant select, alter on mysqltest_1.* to mysqltest_1@localhost; alter table t1 partition by list (s1) (partition p1 values in (2)); ERROR HY000: Table has no partition for value 1 drop table t1; drop user mysqltest_1@localhost; drop schema mysqltest_1; End of 5.1 tests
mysql-test/t/partition_grant.test +23 −1 Original line number Diff line number Diff line Loading @@ -52,8 +52,30 @@ disconnect conn3; connection default; revoke select,alter,drop on mysqltest_1.* from mysqltest_1@localhost; drop user mysqltest_1@localhost; drop table t1; # # Bug #23675 Partitions: possible security breach via alter # create table t1 (s1 int); insert into t1 values (1); grant alter on mysqltest_1.* to mysqltest_1@localhost; connect (conn4,localhost,mysqltest_1,,mysqltest_1); connection conn4; --error 1514 alter table t1 partition by list (s1) (partition p1 values in (2)); connection default; grant select, alter on mysqltest_1.* to mysqltest_1@localhost; disconnect conn4; connect (conn5,localhost,mysqltest_1,,mysqltest_1); --error 1514 alter table t1 partition by list (s1) (partition p1 values in (2)); disconnect conn5; connection default; drop table t1; drop user mysqltest_1@localhost; drop schema mysqltest_1; --echo End of 5.1 tests
sql/mysql_priv.h +1 −1 Original line number Diff line number Diff line Loading @@ -599,7 +599,7 @@ class THD; void close_thread_tables(THD *thd, bool locked=0, bool skip_derived=0); bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables); bool check_single_table_access(THD *thd, ulong privilege, TABLE_LIST *tables); TABLE_LIST *tables, bool no_errors); bool check_routine_access(THD *thd,ulong want_access,char *db,char *name, bool is_proc, bool no_errors); bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table); Loading
sql/partition_info.cc +19 −7 Original line number Diff line number Diff line Loading @@ -849,8 +849,19 @@ void partition_info::print_no_partition_found(TABLE *table) { char buf[100]; char *buf_ptr= (char*)&buf; my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set); TABLE_LIST table_list; bzero(&table_list, sizeof(table_list)); table_list.db= table->s->db.str; table_list.table_name= table->s->table_name.str; if (check_single_table_access(current_thd, SELECT_ACL, &table_list, TRUE)) my_message(ER_NO_PARTITION_FOR_GIVEN_VALUE, ER(ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT), MYF(0)); else { my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set); if (part_expr->null_value) buf_ptr= (char*)"NULL"; else Loading @@ -859,6 +870,7 @@ void partition_info::print_no_partition_found(TABLE *table) my_error(ER_NO_PARTITION_FOR_GIVEN_VALUE, MYF(0), buf_ptr); dbug_tmp_restore_column_map(table->read_set, old_map); } } /* Set up buffers and arrays for fields requiring preparation SYNOPSIS Loading
sql/share/errmsg.txt +2 −0 Original line number Diff line number Diff line Loading @@ -6057,3 +6057,5 @@ ER_EVENT_CANNOT_ALTER_IN_THE_PAST eng "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been altered" ER_SLAVE_INCIDENT eng "The incident %s occured on the master. Message: %-.64s" ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT eng "Table has no partition for some existing values"