@@ -1305,8 +1305,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
13051305 table_list.alias = table_list.table_name = conv_name.str ;
13061306 packet= arg_end + 1 ;
13071307
1308- if (!my_strcasecmp (system_charset_info, table_list.db ,
1309- INFORMATION_SCHEMA_NAME.str ))
1308+ if (is_schema_db (table_list.db , table_list.db_length ))
13101309 {
13111310 ST_SCHEMA_TABLE *schema_table= find_schema_table (thd, table_list.alias );
13121311 if (schema_table)
@@ -1368,7 +1367,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
13681367 break ;
13691368 }
13701369 if (check_access (thd, CREATE_ACL, db.str , 0 , 1 , 0 ,
1371- is_schema_db (db.str )))
1370+ is_schema_db (db.str , db. length )))
13721371 break ;
13731372 general_log_print (thd, command, " %.*s" , db.length , db.str );
13741373 bzero (&create_info, sizeof (create_info));
@@ -1387,7 +1386,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
13871386 my_error (ER_WRONG_DB_NAME, MYF (0 ), db.str ? db.str : " NULL" );
13881387 break ;
13891388 }
1390- if (check_access (thd, DROP_ACL, db.str , 0 , 1 , 0 , is_schema_db (db.str )))
1389+ if (check_access (thd, DROP_ACL, db.str , 0 , 1 , 0 ,
1390+ is_schema_db (db.str , db.length )))
13911391 break ;
13921392 if (thd->locked_tables || thd->active_transaction ())
13931393 {
@@ -2852,7 +2852,7 @@ mysql_execute_command(THD *thd)
28522852 &first_table->grant .privilege , 0 , 0 ,
28532853 test (first_table->schema_table )) ||
28542854 check_access (thd,INSERT_ACL | CREATE_ACL,select_lex->db ,&priv,0 ,0 ,
2855- is_schema_db (select_lex->db ))||
2855+ is_schema_db (select_lex->db , strlen (select_lex-> db ) ))||
28562856 check_merge_table_access (thd, first_table->db ,
28572857 (TABLE_LIST *)
28582858 create_info.merge_list .first ))
@@ -3590,7 +3590,7 @@ mysql_execute_command(THD *thd)
35903590 }
35913591#endif
35923592 if (check_access (thd,CREATE_ACL,lex->name .str , 0 , 1 , 0 ,
3593- is_schema_db (lex->name .str )))
3593+ is_schema_db (lex->name .str , lex-> name . length )))
35943594 break ;
35953595 res= mysql_create_db (thd,(lower_case_table_names == 2 ? alias :
35963596 lex->name .str ), &create_info, 0 );
@@ -3625,7 +3625,7 @@ mysql_execute_command(THD *thd)
36253625 }
36263626#endif
36273627 if (check_access (thd,DROP_ACL,lex->name .str ,0 ,1 ,0 ,
3628- is_schema_db (lex->name .str )))
3628+ is_schema_db (lex->name .str , lex-> name . length )))
36293629 break ;
36303630 if (thd->locked_tables || thd->active_transaction ())
36313631 {
@@ -3659,9 +3659,12 @@ mysql_execute_command(THD *thd)
36593659 my_error (ER_WRONG_DB_NAME, MYF (0 ), db->str );
36603660 break ;
36613661 }
3662- if (check_access (thd, ALTER_ACL, db->str , 0 , 1 , 0 , is_schema_db (db->str )) ||
3663- check_access (thd, DROP_ACL, db->str , 0 , 1 , 0 , is_schema_db (db->str )) ||
3664- check_access (thd, CREATE_ACL, db->str , 0 , 1 , 0 , is_schema_db (db->str )))
3662+ if (check_access (thd, ALTER_ACL, db->str , 0 , 1 , 0 ,
3663+ is_schema_db (db->str , db->length )) ||
3664+ check_access (thd, DROP_ACL, db->str , 0 , 1 , 0 ,
3665+ is_schema_db (db->str , db->length )) ||
3666+ check_access (thd, CREATE_ACL, db->str , 0 , 1 , 0 ,
3667+ is_schema_db (db->str , db->length )))
36653668 {
36663669 res= 1 ;
36673670 break ;
@@ -3704,7 +3707,8 @@ mysql_execute_command(THD *thd)
37043707 break ;
37053708 }
37063709#endif
3707- if (check_access (thd, ALTER_ACL, db->str , 0 , 1 , 0 , is_schema_db (db->str )))
3710+ if (check_access (thd, ALTER_ACL, db->str , 0 , 1 , 0 ,
3711+ is_schema_db (db->str , db->length )))
37083712 break ;
37093713 if (thd->locked_tables || thd->active_transaction ())
37103714 {
@@ -3860,7 +3864,8 @@ mysql_execute_command(THD *thd)
38603864 first_table ? &first_table->grant .privilege : 0 ,
38613865 first_table ? 0 : 1 , 0 ,
38623866 first_table ? (bool ) first_table->schema_table :
3863- select_lex->db ? is_schema_db (select_lex->db ) : 0 ))
3867+ select_lex->db ?
3868+ is_schema_db (select_lex->db , strlen (select_lex->db )) : 0 ))
38643869 goto error;
38653870
38663871 if (thd->security_ctx ->user ) // If not replication
@@ -4203,7 +4208,8 @@ mysql_execute_command(THD *thd)
42034208 }
42044209
42054210 if (check_access (thd, CREATE_PROC_ACL, lex->sphead ->m_db .str , 0 , 0 , 0 ,
4206- is_schema_db (lex->sphead ->m_db .str )))
4211+ is_schema_db (lex->sphead ->m_db .str ,
4212+ lex->sphead ->m_db .length )))
42074213 goto create_sp_error;
42084214
42094215 if (end_active_trans (thd))
@@ -4858,7 +4864,8 @@ mysql_execute_command(THD *thd)
48584864 res= mysql_xa_recover (thd);
48594865 break ;
48604866 case SQLCOM_ALTER_TABLESPACE:
4861- if (check_access (thd, ALTER_ACL, thd->db , 0 , 1 , 0 , thd->db ? is_schema_db (thd->db ) : 0 ))
4867+ if (check_access (thd, ALTER_ACL, thd->db , 0 , 1 , 0 ,
4868+ thd->db ? is_schema_db (thd->db , thd->db_length ) : 0 ))
48624869 break ;
48634870 if (!(res= mysql_alter_tablespace (thd, lex->alter_tablespace_info )))
48644871 my_ok (thd);
@@ -5297,7 +5304,7 @@ static bool check_show_access(THD *thd, TABLE_LIST *table)
52975304
52985305 if (check_access (thd, SELECT_ACL, dst_db_name,
52995306 &thd->col_access , FALSE , FALSE ,
5300- is_schema_db (dst_db_name)))
5307+ is_schema_db (dst_db_name, strlen (dst_db_name) )))
53015308 return TRUE ;
53025309
53035310 if (!thd->col_access && check_grant_db (thd, dst_db_name))
@@ -6262,8 +6269,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
62626269 ptr->force_index = test (table_options & TL_OPTION_FORCE_INDEX);
62636270 ptr->ignore_leaves = test (table_options & TL_OPTION_IGNORE_LEAVES);
62646271 ptr->derived = table->sel ;
6265- if (!ptr->derived && !my_strcasecmp (system_charset_info, ptr->db ,
6266- INFORMATION_SCHEMA_NAME.str ))
6272+ if (!ptr->derived && is_schema_db (ptr->db , ptr->db_length ))
62676273 {
62686274 ST_SCHEMA_TABLE *schema_table= find_schema_table (thd, ptr->table_name );
62696275 if (!schema_table ||
0 commit comments