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
66bce61a
Commit
66bce61a
authored
Sep 12, 2006
by
msvensson@neptunus.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint
parents
330fb6a3
4afd2054
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
76 additions
and
36 deletions
+76
-36
configure.in
configure.in
+3
-2
include/mysql_com.h
include/mysql_com.h
+4
-1
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+13
-0
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+17
-0
sql-common/client.c
sql-common/client.c
+3
-3
sql/mysql_priv.h
sql/mysql_priv.h
+2
-1
sql/slave.h
sql/slave.h
+1
-1
sql/sp.cc
sql/sp.cc
+4
-4
sql/sp_head.cc
sql/sp_head.cc
+3
-3
sql/sql_acl.cc
sql/sql_acl.cc
+5
-5
sql/sql_class.h
sql/sql_class.h
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+9
-8
sql/sql_repl.h
sql/sql_repl.h
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+6
-4
sql/table.cc
sql/table.cc
+4
-2
No files found.
configure.in
View file @
66bce61a
...
@@ -19,7 +19,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
...
@@ -19,7 +19,7 @@ SHARED_LIB_VERSION=$SHARED_LIB_MAJOR_VERSION:0:0
# ndb version
# ndb version
NDB_VERSION_MAJOR
=
5
NDB_VERSION_MAJOR
=
5
NDB_VERSION_MINOR
=
0
NDB_VERSION_MINOR
=
0
NDB_VERSION_BUILD
=
2
5
NDB_VERSION_BUILD
=
2
6
NDB_VERSION_STATUS
=
""
NDB_VERSION_STATUS
=
""
# Set all version vars based on $VERSION. How do we do this more elegant ?
# Set all version vars based on $VERSION. How do we do this more elegant ?
...
@@ -2826,8 +2826,9 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
...
@@ -2826,8 +2826,9 @@ AC_CONFIG_FILES(Makefile extra/Makefile mysys/Makefile dnl
include/mysql_version.h dnl
include/mysql_version.h dnl
cmd-line-utils/Makefile dnl
cmd-line-utils/Makefile dnl
cmd-line-utils/libedit/Makefile dnl
cmd-line-utils/libedit/Makefile dnl
win/Makefile dnl
zlib/Makefile dnl
zlib/Makefile dnl
cmd-line-utils/readline/Makefile
win/Makefile
)
cmd-line-utils/readline/Makefile
)
AC_CONFIG_COMMANDS
([
default], ,
test
-z
"
$CONFIG_HEADERS
"
||
echo
timestamp
>
stamp-h
)
AC_CONFIG_COMMANDS
([
default], ,
test
-z
"
$CONFIG_HEADERS
"
||
echo
timestamp
>
stamp-h
)
AC_OUTPUT
AC_OUTPUT
...
...
include/mysql_com.h
View file @
66bce61a
...
@@ -26,6 +26,9 @@
...
@@ -26,6 +26,9 @@
#define USERNAME_LENGTH 16
#define USERNAME_LENGTH 16
#define SERVER_VERSION_LENGTH 60
#define SERVER_VERSION_LENGTH 60
#define SQLSTATE_LENGTH 5
#define SQLSTATE_LENGTH 5
#define SYSTEM_CHARSET_MBMAXLEN 3
#define NAME_BYTE_LEN NAME_LEN*SYSTEM_CHARSET_MBMAXLEN
#define USERNAME_BYTE_LENGTH USERNAME_LENGTH*SYSTEM_CHARSET_MBMAXLEN
/*
/*
USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain
...
@@ -33,7 +36,7 @@
...
@@ -33,7 +36,7 @@
MySQL standard format:
MySQL standard format:
user_name_part@host_name_part\0
user_name_part@host_name_part\0
*/
*/
#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2
#define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_
BYTE_
LENGTH + 2
#define LOCAL_HOST "localhost"
#define LOCAL_HOST "localhost"
#define LOCAL_HOST_NAMEDPIPE "."
#define LOCAL_HOST_NAMEDPIPE "."
...
...
mysql-test/r/ctype_utf8.result
View file @
66bce61a
...
@@ -1340,6 +1340,19 @@ select a from t1 group by a;
...
@@ -1340,6 +1340,19 @@ select a from t1 group by a;
a
a
e
e
drop table t1;
drop table t1;
set names utf8;
grant select on test.* to юзер_юзер@localhost;
user()
юзер_юзер@localhost
revoke all on test.* from юзер_юзер@localhost;
drop user юзер_юзер@localhost;
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
select database();
database()
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
use test;
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
CREATE TABLE t1(id varchar(20) NOT NULL) DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
INSERT INTO t1 VALUES ('xxx'), ('aa'), ('yyy'), ('aa');
SELECT id FROM t1;
SELECT id FROM t1;
...
...
mysql-test/t/ctype_utf8.test
View file @
66bce61a
...
@@ -1069,6 +1069,23 @@ explain select a from t1 group by a;
...
@@ -1069,6 +1069,23 @@ explain select a from t1 group by a;
select
a
from
t1
group
by
a
;
select
a
from
t1
group
by
a
;
drop
table
t1
;
drop
table
t1
;
#
# Bug#20393: User name truncation in mysql client
# Bug#21432: Database/Table name limited to 64 bytes, not chars, problems with multi-byte
#
set
names
utf8
;
#create user юзер_юзер@localhost;
grant
select
on
test
.*
to
юзер_юзер
@
localhost
;
--
exec
$MYSQL
--
default
-
character
-
set
=
utf8
--
user
=
юзер_юзер
-
e
"select user()"
revoke
all
on
test
.*
from
юзер_юзер
@
localhost
;
drop
user
юзер_юзер
@
localhost
;
create
database
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
;
use
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
;
select
database
();
drop
database
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
;
use
test
;
# End of 4.1 tests
# End of 4.1 tests
#
#
...
...
sql-common/client.c
View file @
66bce61a
...
@@ -1758,7 +1758,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -1758,7 +1758,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
const
char
*
passwd
,
const
char
*
db
,
const
char
*
passwd
,
const
char
*
db
,
uint
port
,
const
char
*
unix_socket
,
ulong
client_flag
)
uint
port
,
const
char
*
unix_socket
,
ulong
client_flag
)
{
{
char
buff
[
NAME_
LEN
+
USERNAM
E_LENGTH
+
100
];
char
buff
[
NAME_
BYTE_LEN
+
USERNAME_BYT
E_LENGTH
+
100
];
char
*
end
,
*
host_info
;
char
*
end
,
*
host_info
;
my_socket
sock
;
my_socket
sock
;
in_addr_t
ip_addr
;
in_addr_t
ip_addr
;
...
@@ -2217,7 +2217,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -2217,7 +2217,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
mysql
->
server_status
,
client_flag
));
mysql
->
server_status
,
client_flag
));
/* This needs to be changed as it's not useful with big packets */
/* This needs to be changed as it's not useful with big packets */
if
(
user
&&
user
[
0
])
if
(
user
&&
user
[
0
])
strmake
(
end
,
user
,
USERNAME_LENGTH
);
/* Max user name */
strmake
(
end
,
user
,
USERNAME_
BYTE_
LENGTH
);
/* Max user name */
else
else
read_user_name
((
char
*
)
end
);
read_user_name
((
char
*
)
end
);
...
@@ -2247,7 +2247,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
...
@@ -2247,7 +2247,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
/* Add database if needed */
/* Add database if needed */
if
(
db
&&
(
mysql
->
server_capabilities
&
CLIENT_CONNECT_WITH_DB
))
if
(
db
&&
(
mysql
->
server_capabilities
&
CLIENT_CONNECT_WITH_DB
))
{
{
end
=
strmake
(
end
,
db
,
NAME_LEN
)
+
1
;
end
=
strmake
(
end
,
db
,
NAME_
BYTE_
LEN
)
+
1
;
mysql
->
db
=
my_strdup
(
db
,
MYF
(
MY_WME
));
mysql
->
db
=
my_strdup
(
db
,
MYF
(
MY_WME
));
db
=
0
;
db
=
0
;
}
}
...
...
sql/mysql_priv.h
View file @
66bce61a
...
@@ -566,7 +566,8 @@ void get_default_definer(THD *thd, LEX_USER *definer);
...
@@ -566,7 +566,8 @@ void get_default_definer(THD *thd, LEX_USER *definer);
LEX_USER
*
create_default_definer
(
THD
*
thd
);
LEX_USER
*
create_default_definer
(
THD
*
thd
);
LEX_USER
*
create_definer
(
THD
*
thd
,
LEX_STRING
*
user_name
,
LEX_STRING
*
host_name
);
LEX_USER
*
create_definer
(
THD
*
thd
,
LEX_STRING
*
user_name
,
LEX_STRING
*
host_name
);
LEX_USER
*
get_current_user
(
THD
*
thd
,
LEX_USER
*
user
);
LEX_USER
*
get_current_user
(
THD
*
thd
,
LEX_USER
*
user
);
bool
check_string_length
(
LEX_STRING
*
str
,
const
char
*
err_msg
,
uint
max_length
);
bool
check_string_length
(
CHARSET_INFO
*
cs
,
LEX_STRING
*
str
,
const
char
*
err_msg
,
uint
max_length
);
enum
enum_mysql_completiontype
{
enum
enum_mysql_completiontype
{
ROLLBACK_RELEASE
=-
2
,
ROLLBACK
=
1
,
ROLLBACK_AND_CHAIN
=
7
,
ROLLBACK_RELEASE
=-
2
,
ROLLBACK
=
1
,
ROLLBACK_AND_CHAIN
=
7
,
...
...
sql/slave.h
View file @
66bce61a
...
@@ -406,7 +406,7 @@ typedef struct st_master_info
...
@@ -406,7 +406,7 @@ typedef struct st_master_info
/* the variables below are needed because we can change masters on the fly */
/* the variables below are needed because we can change masters on the fly */
char
master_log_name
[
FN_REFLEN
];
char
master_log_name
[
FN_REFLEN
];
char
host
[
HOSTNAME_LENGTH
+
1
];
char
host
[
HOSTNAME_LENGTH
+
1
];
char
user
[
USERNAME_LENGTH
+
1
];
char
user
[
USERNAME_
BYTE_
LENGTH
+
1
];
char
password
[
MAX_PASSWORD_LENGTH
+
1
];
char
password
[
MAX_PASSWORD_LENGTH
+
1
];
my_bool
ssl
;
// enables use of SSL connection if true
my_bool
ssl
;
// enables use of SSL connection if true
char
ssl_ca
[
FN_REFLEN
],
ssl_capath
[
FN_REFLEN
],
ssl_cert
[
FN_REFLEN
];
char
ssl_ca
[
FN_REFLEN
],
ssl_capath
[
FN_REFLEN
],
ssl_cert
[
FN_REFLEN
];
...
...
sql/sp.cc
View file @
66bce61a
...
@@ -404,16 +404,16 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
...
@@ -404,16 +404,16 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp,
{
{
LEX
*
old_lex
=
thd
->
lex
,
newlex
;
LEX
*
old_lex
=
thd
->
lex
,
newlex
;
String
defstr
;
String
defstr
;
char
old_db_buf
[
NAME_LEN
+
1
];
char
old_db_buf
[
NAME_
BYTE_
LEN
+
1
];
LEX_STRING
old_db
=
{
old_db_buf
,
sizeof
(
old_db_buf
)
};
LEX_STRING
old_db
=
{
old_db_buf
,
sizeof
(
old_db_buf
)
};
bool
dbchanged
;
bool
dbchanged
;
ulong
old_sql_mode
=
thd
->
variables
.
sql_mode
;
ulong
old_sql_mode
=
thd
->
variables
.
sql_mode
;
ha_rows
old_select_limit
=
thd
->
variables
.
select_limit
;
ha_rows
old_select_limit
=
thd
->
variables
.
select_limit
;
sp_rcontext
*
old_spcont
=
thd
->
spcont
;
sp_rcontext
*
old_spcont
=
thd
->
spcont
;
char
definer_user_name_holder
[
USERNAME_LENGTH
+
1
];
char
definer_user_name_holder
[
USERNAME_
BYTE_
LENGTH
+
1
];
LEX_STRING_WITH_INIT
definer_user_name
(
definer_user_name_holder
,
LEX_STRING_WITH_INIT
definer_user_name
(
definer_user_name_holder
,
USERNAME_LENGTH
);
USERNAME_
BYTE_
LENGTH
);
char
definer_host_name_holder
[
HOSTNAME_LENGTH
+
1
];
char
definer_host_name_holder
[
HOSTNAME_LENGTH
+
1
];
LEX_STRING_WITH_INIT
definer_host_name
(
definer_host_name_holder
,
LEX_STRING_WITH_INIT
definer_host_name
(
definer_host_name_holder
,
...
@@ -511,7 +511,7 @@ db_create_routine(THD *thd, int type, sp_head *sp)
...
@@ -511,7 +511,7 @@ db_create_routine(THD *thd, int type, sp_head *sp)
int
ret
;
int
ret
;
TABLE
*
table
;
TABLE
*
table
;
char
definer
[
USER_HOST_BUFF_SIZE
];
char
definer
[
USER_HOST_BUFF_SIZE
];
char
old_db_buf
[
NAME_LEN
+
1
];
char
old_db_buf
[
NAME_
BYTE_
LEN
+
1
];
LEX_STRING
old_db
=
{
old_db_buf
,
sizeof
(
old_db_buf
)
};
LEX_STRING
old_db
=
{
old_db_buf
,
sizeof
(
old_db_buf
)
};
bool
dbchanged
;
bool
dbchanged
;
DBUG_ENTER
(
"db_create_routine"
);
DBUG_ENTER
(
"db_create_routine"
);
...
...
sql/sp_head.cc
View file @
66bce61a
...
@@ -924,7 +924,7 @@ bool
...
@@ -924,7 +924,7 @@ bool
sp_head
::
execute
(
THD
*
thd
)
sp_head
::
execute
(
THD
*
thd
)
{
{
DBUG_ENTER
(
"sp_head::execute"
);
DBUG_ENTER
(
"sp_head::execute"
);
char
old_db_buf
[
NAME_LEN
+
1
];
char
old_db_buf
[
NAME_
BYTE_
LEN
+
1
];
LEX_STRING
old_db
=
{
old_db_buf
,
sizeof
(
old_db_buf
)
};
LEX_STRING
old_db
=
{
old_db_buf
,
sizeof
(
old_db_buf
)
};
bool
dbchanged
;
bool
dbchanged
;
sp_rcontext
*
ctx
;
sp_rcontext
*
ctx
;
...
@@ -1957,8 +1957,8 @@ sp_head::set_info(longlong created, longlong modified,
...
@@ -1957,8 +1957,8 @@ sp_head::set_info(longlong created, longlong modified,
void
void
sp_head
::
set_definer
(
const
char
*
definer
,
uint
definerlen
)
sp_head
::
set_definer
(
const
char
*
definer
,
uint
definerlen
)
{
{
char
user_name_holder
[
USERNAME_LENGTH
+
1
];
char
user_name_holder
[
USERNAME_
BYTE_
LENGTH
+
1
];
LEX_STRING_WITH_INIT
user_name
(
user_name_holder
,
USERNAME_LENGTH
);
LEX_STRING_WITH_INIT
user_name
(
user_name_holder
,
USERNAME_
BYTE_
LENGTH
);
char
host_name_holder
[
HOSTNAME_LENGTH
+
1
];
char
host_name_holder
[
HOSTNAME_LENGTH
+
1
];
LEX_STRING_WITH_INIT
host_name
(
host_name_holder
,
HOSTNAME_LENGTH
);
LEX_STRING_WITH_INIT
host_name
(
host_name_holder
,
HOSTNAME_LENGTH
);
...
...
sql/sql_acl.cc
View file @
66bce61a
...
@@ -54,7 +54,7 @@ static byte* acl_entry_get_key(acl_entry *entry,uint *length,
...
@@ -54,7 +54,7 @@ static byte* acl_entry_get_key(acl_entry *entry,uint *length,
}
}
#define IP_ADDR_STRLEN (3+1+3+1+3+1+3)
#define IP_ADDR_STRLEN (3+1+3+1+3+1+3)
#define ACL_KEY_LENGTH (IP_ADDR_STRLEN+1+NAME_
LEN+1+USERNAM
E_LENGTH+1)
#define ACL_KEY_LENGTH (IP_ADDR_STRLEN+1+NAME_
BYTE_LEN+1+USERNAME_BYT
E_LENGTH+1)
static
DYNAMIC_ARRAY
acl_hosts
,
acl_users
,
acl_dbs
;
static
DYNAMIC_ARRAY
acl_hosts
,
acl_users
,
acl_dbs
;
static
MEM_ROOT
mem
,
memex
;
static
MEM_ROOT
mem
,
memex
;
...
@@ -197,7 +197,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
...
@@ -197,7 +197,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
READ_RECORD
read_record_info
;
READ_RECORD
read_record_info
;
my_bool
return_val
=
1
;
my_bool
return_val
=
1
;
bool
check_no_resolve
=
specialflag
&
SPECIAL_NO_RESOLVE
;
bool
check_no_resolve
=
specialflag
&
SPECIAL_NO_RESOLVE
;
char
tmp_name
[
NAME_LEN
+
1
];
char
tmp_name
[
NAME_
BYTE_
LEN
+
1
];
int
password_length
;
int
password_length
;
DBUG_ENTER
(
"acl_load"
);
DBUG_ENTER
(
"acl_load"
);
...
@@ -2264,7 +2264,7 @@ static GRANT_NAME *name_hash_search(HASH *name_hash,
...
@@ -2264,7 +2264,7 @@ static GRANT_NAME *name_hash_search(HASH *name_hash,
const
char
*
user
,
const
char
*
tname
,
const
char
*
user
,
const
char
*
tname
,
bool
exact
)
bool
exact
)
{
{
char
helping
[
NAME_
LEN
*
2
+
USERNAM
E_LENGTH
+
3
];
char
helping
[
NAME_
BYTE_LEN
*
2
+
USERNAME_BYT
E_LENGTH
+
3
];
uint
len
;
uint
len
;
GRANT_NAME
*
grant_name
,
*
found
=
0
;
GRANT_NAME
*
grant_name
,
*
found
=
0
;
HASH_SEARCH_STATE
state
;
HASH_SEARCH_STATE
state
;
...
@@ -3167,7 +3167,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
...
@@ -3167,7 +3167,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
{
{
List_iterator
<
LEX_USER
>
str_list
(
list
);
List_iterator
<
LEX_USER
>
str_list
(
list
);
LEX_USER
*
Str
,
*
tmp_Str
;
LEX_USER
*
Str
,
*
tmp_Str
;
char
tmp_db
[
NAME_LEN
+
1
];
char
tmp_db
[
NAME_
BYTE_
LEN
+
1
];
bool
create_new_users
=
0
;
bool
create_new_users
=
0
;
TABLE_LIST
tables
[
2
];
TABLE_LIST
tables
[
2
];
DBUG_ENTER
(
"mysql_grant"
);
DBUG_ENTER
(
"mysql_grant"
);
...
@@ -3867,7 +3867,7 @@ bool check_grant_all_columns(THD *thd, ulong want_access, GRANT_INFO *grant,
...
@@ -3867,7 +3867,7 @@ bool check_grant_all_columns(THD *thd, ulong want_access, GRANT_INFO *grant,
bool
check_grant_db
(
THD
*
thd
,
const
char
*
db
)
bool
check_grant_db
(
THD
*
thd
,
const
char
*
db
)
{
{
Security_context
*
sctx
=
thd
->
security_ctx
;
Security_context
*
sctx
=
thd
->
security_ctx
;
char
helping
[
NAME_
LEN
+
USERNAM
E_LENGTH
+
2
];
char
helping
[
NAME_
BYTE_LEN
+
USERNAME_BYT
E_LENGTH
+
2
];
uint
len
;
uint
len
;
bool
error
=
1
;
bool
error
=
1
;
...
...
sql/sql_class.h
View file @
66bce61a
...
@@ -200,7 +200,7 @@ class MYSQL_LOG: public TC_LOG
...
@@ -200,7 +200,7 @@ class MYSQL_LOG: public TC_LOG
IO_CACHE
log_file
;
IO_CACHE
log_file
;
IO_CACHE
index_file
;
IO_CACHE
index_file
;
char
*
name
;
char
*
name
;
char
time_buff
[
20
],
db
[
NAME_LEN
+
1
];
char
time_buff
[
20
],
db
[
NAME_
BYTE_
LEN
+
1
];
char
log_file_name
[
FN_REFLEN
],
index_file_name
[
FN_REFLEN
];
char
log_file_name
[
FN_REFLEN
],
index_file_name
[
FN_REFLEN
];
/*
/*
The max size before rotation (usable only if log_type == LOG_BIN: binary
The max size before rotation (usable only if log_type == LOG_BIN: binary
...
...
sql/sql_parse.cc
View file @
66bce61a
...
@@ -1001,8 +1001,8 @@ static int check_connection(THD *thd)
...
@@ -1001,8 +1001,8 @@ static int check_connection(THD *thd)
char
*
passwd
=
strend
(
user
)
+
1
;
char
*
passwd
=
strend
(
user
)
+
1
;
uint
user_len
=
passwd
-
user
-
1
;
uint
user_len
=
passwd
-
user
-
1
;
char
*
db
=
passwd
;
char
*
db
=
passwd
;
char
db_buff
[
NAME_
LEN
+
1
];
// buffer to store db in utf8
char
db_buff
[
NAME_
BYTE_LEN
+
1
];
// buffer to store db in utf8
char
user_buff
[
USERNAME_
LENGTH
+
1
];
// buffer to store user in utf8
char
user_buff
[
USERNAME_
BYTE_LENGTH
+
1
];
// buffer to store user in utf8
uint
dummy_errors
;
uint
dummy_errors
;
/*
/*
...
@@ -1662,7 +1662,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1662,7 +1662,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
password. New clients send the size (1 byte) + string (not null
password. New clients send the size (1 byte) + string (not null
terminated, so also '\0' for empty string).
terminated, so also '\0' for empty string).
*/
*/
char
db_buff
[
NAME_
LEN
+
1
];
// buffer to store db in utf8
char
db_buff
[
NAME_
BYTE_LEN
+
1
];
// buffer to store db in utf8
char
*
db
=
passwd
;
char
*
db
=
passwd
;
uint
passwd_len
=
thd
->
client_capabilities
&
CLIENT_SECURE_CONNECTION
?
uint
passwd_len
=
thd
->
client_capabilities
&
CLIENT_SECURE_CONNECTION
?
*
passwd
++
:
strlen
(
passwd
);
*
passwd
++
:
strlen
(
passwd
);
...
@@ -7552,6 +7552,7 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user)
...
@@ -7552,6 +7552,7 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user)
SYNOPSIS
SYNOPSIS
check_string_length()
check_string_length()
cs string charset
str string to be checked
str string to be checked
err_msg error message to be displayed if the string is too long
err_msg error message to be displayed if the string is too long
max_length max length
max_length max length
...
@@ -7561,13 +7562,13 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user)
...
@@ -7561,13 +7562,13 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user)
TRUE the passed string is longer than max_length
TRUE the passed string is longer than max_length
*/
*/
bool
check_string_length
(
LEX_STRING
*
str
,
const
char
*
err_msg
,
bool
check_string_length
(
CHARSET_INFO
*
cs
,
LEX_STRING
*
str
,
uint
max_length
)
const
char
*
err_msg
,
uint
max_length
)
{
{
if
(
str
->
length
<=
max_length
)
if
(
cs
->
cset
->
charpos
(
cs
,
str
->
str
,
str
->
str
+
str
->
length
,
return
FALSE
;
max_length
)
>=
str
->
length
)
return
FALSE
;
my_error
(
ER_WRONG_STRING_LENGTH
,
MYF
(
0
),
str
->
str
,
err_msg
,
max_length
);
my_error
(
ER_WRONG_STRING_LENGTH
,
MYF
(
0
),
str
->
str
,
err_msg
,
max_length
);
return
TRUE
;
return
TRUE
;
}
}
sql/sql_repl.h
View file @
66bce61a
...
@@ -22,7 +22,7 @@ typedef struct st_slave_info
...
@@ -22,7 +22,7 @@ typedef struct st_slave_info
uint32
server_id
;
uint32
server_id
;
uint32
rpl_recovery_rank
,
master_id
;
uint32
rpl_recovery_rank
,
master_id
;
char
host
[
HOSTNAME_LENGTH
+
1
];
char
host
[
HOSTNAME_LENGTH
+
1
];
char
user
[
USERNAME_LENGTH
+
1
];
char
user
[
USERNAME_
BYTE_
LENGTH
+
1
];
char
password
[
MAX_PASSWORD_LENGTH
+
1
];
char
password
[
MAX_PASSWORD_LENGTH
+
1
];
uint16
port
;
uint16
port
;
THD
*
thd
;
THD
*
thd
;
...
...
sql/sql_yacc.yy
View file @
66bce61a
...
@@ -7507,7 +7507,8 @@ user:
...
@@ -7507,7 +7507,8 @@ user:
$$->host.str= (char *) "%";
$$->host.str= (char *) "%";
$$->host.length= 1;
$$->host.length= 1;
if (check_string_length(&$$->user, ER(ER_USERNAME), USERNAME_LENGTH))
if (check_string_length(system_charset_info, &$$->user,
ER(ER_USERNAME), USERNAME_LENGTH))
YYABORT;
YYABORT;
}
}
| ident_or_text '@' ident_or_text
| ident_or_text '@' ident_or_text
...
@@ -7517,9 +7518,10 @@ user:
...
@@ -7517,9 +7518,10 @@ user:
YYABORT;
YYABORT;
$$->user = $1; $$->host=$3;
$$->user = $1; $$->host=$3;
if (check_string_length(&$$->user, ER(ER_USERNAME), USERNAME_LENGTH) ||
if (check_string_length(system_charset_info, &$$->user,
check_string_length(&$$->host, ER(ER_HOSTNAME),
ER(ER_USERNAME), USERNAME_LENGTH) ||
HOSTNAME_LENGTH))
check_string_length(&my_charset_latin1, &$$->host,
ER(ER_HOSTNAME), HOSTNAME_LENGTH))
YYABORT;
YYABORT;
}
}
| CURRENT_USER optional_braces
| CURRENT_USER optional_braces
...
...
sql/table.cc
View file @
66bce61a
...
@@ -1592,7 +1592,7 @@ char *get_field(MEM_ROOT *mem, Field *field)
...
@@ -1592,7 +1592,7 @@ char *get_field(MEM_ROOT *mem, Field *field)
bool
check_db_name
(
char
*
name
)
bool
check_db_name
(
char
*
name
)
{
{
char
*
start
=
name
;
uint
name_length
=
0
;
// name length in symbols
/* Used to catch empty names and names with end space */
/* Used to catch empty names and names with end space */
bool
last_char_is_space
=
TRUE
;
bool
last_char_is_space
=
TRUE
;
...
@@ -1609,6 +1609,7 @@ bool check_db_name(char *name)
...
@@ -1609,6 +1609,7 @@ bool check_db_name(char *name)
name
+
system_charset_info
->
mbmaxlen
);
name
+
system_charset_info
->
mbmaxlen
);
if
(
len
)
if
(
len
)
{
{
name_length
++
;
name
+=
len
;
name
+=
len
;
continue
;
continue
;
}
}
...
@@ -1616,12 +1617,13 @@ bool check_db_name(char *name)
...
@@ -1616,12 +1617,13 @@ bool check_db_name(char *name)
#else
#else
last_char_is_space
=
*
name
==
' '
;
last_char_is_space
=
*
name
==
' '
;
#endif
#endif
name_length
++
;
if
(
*
name
==
'/'
||
*
name
==
'\\'
||
*
name
==
FN_LIBCHAR
||
if
(
*
name
==
'/'
||
*
name
==
'\\'
||
*
name
==
FN_LIBCHAR
||
*
name
==
FN_EXTCHAR
)
*
name
==
FN_EXTCHAR
)
return
1
;
return
1
;
name
++
;
name
++
;
}
}
return
last_char_is_space
||
(
uint
)
(
name
-
start
)
>
NAME_LEN
;
return
(
last_char_is_space
||
name_length
>
NAME_LEN
)
;
}
}
...
...
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