File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1
1
#ifndef AUTH_COMMON_INCLUDED
2
2
#define AUTH_COMMON_INCLUDED
3
3
4
- /* Copyright (c) 2000, 2017 , Oracle and/or its affiliates. All rights reserved.
4
+ /* Copyright (c) 2000, 2018 , Oracle and/or its affiliates. All rights reserved.
5
5
6
6
This program is free software; you can redistribute it and/or modify
7
7
it under the terms of the GNU General Public License as published by
@@ -560,6 +560,13 @@ class Acl_load_user_table_schema_factory
560
560
table->field [Acl_load_user_table_old_schema::MYSQL_USER_FIELD_PASSWORD_56];
561
561
return strncmp (password_field->field_name , " Password" , 8 ) == 0 ;
562
562
}
563
+
564
+ virtual bool user_table_schema_check (TABLE* table)
565
+ {
566
+ return table->s ->fields >
567
+ Acl_load_user_table_old_schema::MYSQL_USER_FIELD_PASSWORD_56;
568
+ }
569
+
563
570
virtual ~Acl_load_user_table_schema_factory () {}
564
571
};
565
572
Original file line number Diff line number Diff line change 1
- /* Copyright (c) 2000, 2017 , Oracle and/or its affiliates. All rights reserved.
1
+ /* Copyright (c) 2000, 2018 , Oracle and/or its affiliates. All rights reserved.
2
2
3
3
This program is free software; you can redistribute it and/or modify
4
4
it under the terms of the GNU General Public License as published by
@@ -1495,8 +1495,18 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
1495
1495
We need to check whether we are working with old database layout. This
1496
1496
might be the case for instance when we are running mysql_upgrade.
1497
1497
*/
1498
- table_schema= user_table_schema_factory.get_user_table_schema (table);
1499
- is_old_db_layout= user_table_schema_factory.is_old_user_table_schema (table);
1498
+ if (user_table_schema_factory.user_table_schema_check (table))
1499
+ {
1500
+ table_schema= user_table_schema_factory.get_user_table_schema (table);
1501
+ is_old_db_layout= user_table_schema_factory.is_old_user_table_schema (table);
1502
+ }
1503
+ else
1504
+ {
1505
+ sql_print_error (" [FATAL] mysql.user table is damaged. "
1506
+ " Please run mysql_upgrade." );
1507
+ end_read_record (&read_record_info);
1508
+ goto end;
1509
+ }
1500
1510
1501
1511
allow_all_hosts=0 ;
1502
1512
int read_rec_errcode;
You can’t perform that action at this time.
0 commit comments