summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-09-20 16:57:58 -0700
committerunknown <jimw@mysql.com>2005-09-20 16:57:58 -0700
commit67b470f736e9ce5d90a8aebc81319760bf33723e (patch)
treee1a1c790c3cca386f2d20ff5f530c4531edcd3ed
parent3ce33c2c5281ef33f03ff0df1c177bd4be1b9670 (diff)
downloadmariadb-git-67b470f736e9ce5d90a8aebc81319760bf33723e.tar.gz
Fix handling of password field at the old size (16 characters) but in
the UTF-8 character set. (Bug #13064) sql/sql_acl.cc: Take character set of passworld field into account when figuring out what format it is in (3.23/4.0 or 4.1).
-rw-r--r--sql/sql_acl.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 1b5f69c7873..47c6343bc3b 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -193,6 +193,7 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
my_bool return_val= 1;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
char tmp_name[NAME_LEN+1];
+ int password_length;
DBUG_ENTER("acl_load");
priv_version++; /* Privileges updated */
@@ -250,7 +251,9 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
init_read_record(&read_record_info,thd,table=tables[1].table,NULL,1,0);
VOID(my_init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100));
- if (table->field[2]->field_length < SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
+ password_length= table->field[2]->field_length /
+ table->field[2]->charset()->mbmaxlen;
+ if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{
sql_print_error("Fatal error: mysql.user table is damaged or in "
"unsupported 3.20 format.");
@@ -258,10 +261,10 @@ static my_bool acl_load(THD *thd, TABLE_LIST *tables)
}
DBUG_PRINT("info",("user table fields: %d, password length: %d",
- table->fields, table->field[2]->field_length));
+ table->fields, password_length));
pthread_mutex_lock(&LOCK_global_system_variables);
- if (table->field[2]->field_length < SCRAMBLED_PASSWORD_CHAR_LENGTH)
+ if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH)
{
if (opt_secure_auth)
{