Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f4e46c5c
Commit
f4e46c5c
authored
May 23, 2010
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
6ef03ea3
d72a4710
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
29 deletions
+95
-29
mysql-test/r/renamedb.result
mysql-test/r/renamedb.result
+1
-1
mysql-test/r/upgrade.result
mysql-test/r/upgrade.result
+28
-0
mysql-test/t/renamedb.test
mysql-test/t/renamedb.test
+1
-1
mysql-test/t/upgrade.test
mysql-test/t/upgrade.test
+34
-0
sql/mysql_priv.h
sql/mysql_priv.h
+1
-0
sql/sql_table.cc
sql/sql_table.cc
+20
-3
sql/table.cc
sql/table.cc
+10
-24
No files found.
mysql-test/r/renamedb.result
View file @
f4e46c5c
...
...
@@ -7,6 +7,6 @@ ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and n
ALTER DATABASE `#mysql51#not-yet` UPGRADE DATA DIRECTORY NAME;
ERROR HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and name
ALTER DATABASE `#mysql50#` UPGRADE DATA DIRECTORY NAME;
ERROR
HY000: Incorrect usage of ALTER DATABASE UPGRADE DATA DIRECTORY NAME and name
ERROR
42000: Incorrect database name '#mysql50#'
ALTER DATABASE `#mysql50#upgrade-me` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Unknown database '#mysql50#upgrade-me'
mysql-test/r/upgrade.result
View file @
f4e46c5c
...
...
@@ -112,3 +112,31 @@ select * from `a-b-c`.v1;
f1
drop database `a-b-c`;
use test;
# End of 5.0 tests
#
# Bug #53804: serious flaws in the alter database .. upgrade data
# directory name command
#
ALTER DATABASE `#mysql50#:` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Unknown database '#mysql50#:'
ALTER DATABASE `#mysql50#.` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Incorrect database name '#mysql50#.'
ALTER DATABASE `#mysql50#../` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Incorrect database name '#mysql50#../'
ALTER DATABASE `#mysql50#../..` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Incorrect database name '#mysql50#../..'
ALTER DATABASE `#mysql50#../../` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Incorrect database name '#mysql50#../../'
ALTER DATABASE `#mysql50#./blablabla` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Incorrect database name '#mysql50#./blablabla'
ALTER DATABASE `#mysql50#../blablabla` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Incorrect database name '#mysql50#../blablabla'
ALTER DATABASE `#mysql50#/` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Incorrect database name '#mysql50#/'
ALTER DATABASE `#mysql50#/.` UPGRADE DATA DIRECTORY NAME;
ERROR 42000: Incorrect database name '#mysql50#/.'
USE `#mysql50#.`;
ERROR 42000: Incorrect database name '#mysql50#.'
USE `#mysql50#../blablabla`;
ERROR 42000: Incorrect database name '#mysql50#../blablabla'
# End of 5.1 tests
mysql-test/t/renamedb.test
View file @
f4e46c5c
...
...
@@ -44,7 +44,7 @@ ALTER DATABASE `#mysql41#not-supported` UPGRADE DATA DIRECTORY NAME;
--
error
ER_WRONG_USAGE
ALTER
DATABASE
`#mysql51#not-yet`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_WRONG_
USAG
E
--
error
ER_WRONG_
DB_NAM
E
ALTER
DATABASE
`#mysql50#`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_BAD_DB_ERROR
...
...
mysql-test/t/upgrade.test
View file @
f4e46c5c
...
...
@@ -137,3 +137,37 @@ select * from `a-b-c`.v1;
--
enable_ps_protocol
drop
database
`a-b-c`
;
use
test
;
--
echo
# End of 5.0 tests
--
echo
#
--
echo
# Bug #53804: serious flaws in the alter database .. upgrade data
--
echo
# directory name command
--
echo
#
--
error
ER_BAD_DB_ERROR
ALTER
DATABASE
`#mysql50#:`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_WRONG_DB_NAME
ALTER
DATABASE
`#mysql50#.`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_WRONG_DB_NAME
ALTER
DATABASE
`#mysql50#../`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_WRONG_DB_NAME
ALTER
DATABASE
`#mysql50#../..`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_WRONG_DB_NAME
ALTER
DATABASE
`#mysql50#../../`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_WRONG_DB_NAME
ALTER
DATABASE
`#mysql50#./blablabla`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_WRONG_DB_NAME
ALTER
DATABASE
`#mysql50#../blablabla`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_WRONG_DB_NAME
ALTER
DATABASE
`#mysql50#/`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_WRONG_DB_NAME
ALTER
DATABASE
`#mysql50#/.`
UPGRADE
DATA
DIRECTORY
NAME
;
--
error
ER_WRONG_DB_NAME
USE
`#mysql50#.`
;
--
error
ER_WRONG_DB_NAME
USE
`#mysql50#../blablabla`
;
--
echo
# End of 5.1 tests
sql/mysql_priv.h
View file @
f4e46c5c
...
...
@@ -2293,6 +2293,7 @@ uint explain_filename(THD* thd, const char *from, char *to, uint to_length,
uint
filename_to_tablename
(
const
char
*
from
,
char
*
to
,
uint
to_length
);
uint
tablename_to_filename
(
const
char
*
from
,
char
*
to
,
uint
to_length
);
uint
check_n_cut_mysql50_prefix
(
const
char
*
from
,
char
*
to
,
uint
to_length
);
bool
check_mysql50_prefix
(
const
char
*
name
);
#endif
/* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
uint
build_table_filename
(
char
*
buff
,
size_t
bufflen
,
const
char
*
db
,
...
...
sql/sql_table.cc
View file @
f4e46c5c
...
...
@@ -391,6 +391,25 @@ uint filename_to_tablename(const char *from, char *to, uint to_length)
}
/**
Check if given string begins with "#mysql50#" prefix
@param name string to check cut
@retval
FALSE no prefix found
@retval
TRUE prefix found
*/
bool
check_mysql50_prefix
(
const
char
*
name
)
{
return
(
name
[
0
]
==
'#'
&&
!
strncmp
(
name
,
MYSQL50_TABLE_NAME_PREFIX
,
MYSQL50_TABLE_NAME_PREFIX_LENGTH
));
}
/**
Check if given string begins with "#mysql50#" prefix, cut it if so.
...
...
@@ -406,9 +425,7 @@ uint filename_to_tablename(const char *from, char *to, uint to_length)
uint
check_n_cut_mysql50_prefix
(
const
char
*
from
,
char
*
to
,
uint
to_length
)
{
if
(
from
[
0
]
==
'#'
&&
!
strncmp
(
from
,
MYSQL50_TABLE_NAME_PREFIX
,
MYSQL50_TABLE_NAME_PREFIX_LENGTH
))
if
(
check_mysql50_prefix
(
from
))
return
(
uint
)
(
strmake
(
to
,
from
+
MYSQL50_TABLE_NAME_PREFIX_LENGTH
,
to_length
-
1
)
-
to
);
return
0
;
...
...
sql/table.cc
View file @
f4e46c5c
...
...
@@ -2689,44 +2689,30 @@ bool check_db_name(LEX_STRING *org_name)
{
char
*
name
=
org_name
->
str
;
uint
name_length
=
org_name
->
length
;
bool
check_for_path_chars
;
if
(
!
name_length
||
name_length
>
NAME_LEN
)
return
1
;
if
((
check_for_path_chars
=
check_mysql50_prefix
(
name
)))
{
name
+=
MYSQL50_TABLE_NAME_PREFIX_LENGTH
;
name_length
-=
MYSQL50_TABLE_NAME_PREFIX_LENGTH
;
}
if
(
lower_case_table_names
&&
name
!=
any_db
)
my_casedn_str
(
files_charset_info
,
name
);
#if defined(USE_MB) && defined(USE_MB_IDENT)
if
(
use_mb
(
system_charset_info
))
{
name_length
=
0
;
bool
last_char_is_space
=
TRUE
;
char
*
end
=
name
+
org_name
->
length
;
while
(
name
<
end
)
{
int
len
;
last_char_is_space
=
my_isspace
(
system_charset_info
,
*
name
);
len
=
my_ismbchar
(
system_charset_info
,
name
,
end
);
if
(
!
len
)
len
=
1
;
name
+=
len
;
name_length
++
;
}
return
(
last_char_is_space
||
name_length
>
NAME_CHAR_LEN
);
}
else
#endif
return
((
org_name
->
str
[
org_name
->
length
-
1
]
!=
' '
)
||
(
name_length
>
NAME_CHAR_LEN
));
/* purecov: inspected */
return
check_table_name
(
name
,
name_length
,
check_for_path_chars
);
}
/*
Allow anything as a table name, as long as it doesn't contain an
' ' at the end
returns 1 on error
*/
bool
check_table_name
(
const
char
*
name
,
uint
length
,
bool
check_for_path_chars
)
{
uint
name_length
=
0
;
// name length in symbols
...
...
@@ -2754,10 +2740,10 @@ bool check_table_name(const char *name, uint length, bool check_for_path_chars)
continue
;
}
}
#endif
if
(
check_for_path_chars
&&
(
*
name
==
'/'
||
*
name
==
'\\'
||
*
name
==
'~'
||
*
name
==
FN_EXTCHAR
))
return
1
;
#endif
name
++
;
name_length
++
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment