mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Automerge MariaDB 5.1.44b release.
This commit is contained in:
22
sql/table.cc
22
sql/table.cc
@ -494,6 +494,19 @@ inline bool is_system_table_name(const char *name, uint length)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Check if a string contains path elements
|
||||
*/
|
||||
|
||||
static inline bool has_disabled_path_chars(const char *str)
|
||||
{
|
||||
for (; *str; str++)
|
||||
if (*str == FN_EXTCHAR || *str == '/' || *str == '\\' || *str == '~' || *str == '@')
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Read table definition from a binary / text based .frm file
|
||||
|
||||
@ -548,7 +561,8 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
|
||||
This kind of tables must have been opened only by the
|
||||
my_open() above.
|
||||
*/
|
||||
if (strchr(share->table_name.str, '@') ||
|
||||
if (has_disabled_path_chars(share->table_name.str) ||
|
||||
has_disabled_path_chars(share->db.str) ||
|
||||
!strncmp(share->db.str, MYSQL50_TABLE_NAME_PREFIX,
|
||||
MYSQL50_TABLE_NAME_PREFIX_LENGTH) ||
|
||||
!strncmp(share->table_name.str, MYSQL50_TABLE_NAME_PREFIX,
|
||||
@ -2718,7 +2732,6 @@ bool check_db_name(LEX_STRING *org_name)
|
||||
(name_length > NAME_CHAR_LEN)); /* purecov: inspected */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Allow anything as a table name, as long as it doesn't contain an
|
||||
' ' at the end
|
||||
@ -2726,7 +2739,7 @@ bool check_db_name(LEX_STRING *org_name)
|
||||
*/
|
||||
|
||||
|
||||
bool check_table_name(const char *name, uint length)
|
||||
bool check_table_name(const char *name, uint length, bool check_for_path_chars)
|
||||
{
|
||||
uint name_length= 0; // name length in symbols
|
||||
const char *end= name+length;
|
||||
@ -2753,6 +2766,9 @@ bool check_table_name(const char *name, uint length)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (check_for_path_chars &&
|
||||
(*name == '/' || *name == '\\' || *name == '~' || *name == FN_EXTCHAR))
|
||||
return 1;
|
||||
#endif
|
||||
name++;
|
||||
name_length++;
|
||||
|
Reference in New Issue
Block a user