Commit 4ef211ee authored by unknown's avatar unknown

after merge fix


sql/mysql_priv.h:
  after merge fix
  added charset parameter to check_string_length() function
sql/slave.h:
  after merge fix
  USERNAME_LENGTH const is changed to USERNAME_BYTE_LENGTH
sql/sql_parse.cc:
  after merge fix
  added charset parameter to check_string_length() function
sql/sql_yacc.yy:
  after merge fix
  added charset parameter to check_string_length() function
parent dc6243e5
......@@ -566,7 +566,8 @@ void get_default_definer(THD *thd, LEX_USER *definer);
LEX_USER *create_default_definer(THD *thd);
LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name);
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 {
ROLLBACK_RELEASE=-2, ROLLBACK=1, ROLLBACK_AND_CHAIN=7,
......
......@@ -406,7 +406,7 @@ typedef struct st_master_info
/* the variables below are needed because we can change masters on the fly */
char master_log_name[FN_REFLEN];
char host[HOSTNAME_LENGTH+1];
char user[USERNAME_LENGTH+1];
char user[USERNAME_BYTE_LENGTH+1];
char password[MAX_PASSWORD_LENGTH+1];
my_bool ssl; // enables use of SSL connection if true
char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN];
......
......@@ -7552,6 +7552,7 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user)
SYNOPSIS
check_string_length()
cs string charset
str string to be checked
err_msg error message to be displayed if the string is too long
max_length max length
......@@ -7561,16 +7562,13 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user)
TRUE the passed string is longer than max_length
*/
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)
{
if (system_charset_info->cset->charpos(system_charset_info, str->str,
str->str + str->length, max_length) >=
str->length)
return FALSE;
if (cs->cset->charpos(cs, str->str, str->str + str->length,
max_length) >= str->length)
return FALSE;
my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_length);
return TRUE;
}
......@@ -7507,7 +7507,8 @@ user:
$$->host.str= (char *) "%";
$$->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;
}
| ident_or_text '@' ident_or_text
......@@ -7517,9 +7518,10 @@ user:
YYABORT;
$$->user = $1; $$->host=$3;
if (check_string_length(&$$->user, ER(ER_USERNAME), USERNAME_LENGTH) ||
check_string_length(&$$->host, ER(ER_HOSTNAME),
HOSTNAME_LENGTH))
if (check_string_length(system_charset_info, &$$->user,
ER(ER_USERNAME), USERNAME_LENGTH) ||
check_string_length(&my_charset_latin1, &$$->host,
ER(ER_HOSTNAME), HOSTNAME_LENGTH))
YYABORT;
}
| CURRENT_USER optional_braces
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment