From 743cad72f6c31ed5b2c2ae46fbc6f5ac4177e4e6 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Tue, 20 Sep 2005 16:57:58 -0700 Subject: [PATCH 1/3] Fix handling of password field at the old size (16 characters) but in the UTF-8 character set. (Bug #13064) --- sql/sql_acl.cc | 9 ++++++--- 1 file 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) { From 083c032ec3866697900d504e8e0c0c39da1a59a3 Mon Sep 17 00:00:00 2001 From: "jimw@mysql.com" <> Date: Mon, 10 Oct 2005 19:39:16 -0700 Subject: [PATCH 2/3] Fix minimum value of query_prealloc_size to be the same as its default. (Bug #13334) --- mysql-test/r/variables.result | 5 +++++ mysql-test/t/variables.test | 10 +++++++++- sql/mysqld.cc | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 67c78d82a24..0aa7ea7f83c 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -499,3 +499,8 @@ set names latin1; select @@have_innodb; @@have_innodb # +set @test = @@query_prealloc_size; +set @@query_prealloc_size = @test; +select @@query_prealloc_size = @test; +@@query_prealloc_size = @test +1 diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index a8844070207..8322c0f84bd 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -388,7 +388,6 @@ set character_set_results=NULL; select ifnull(@@character_set_results,"really null"); set names latin1; -# End of 4.1 tests # # Bug #9613: @@have_innodb @@ -396,3 +395,12 @@ set names latin1; --replace_column 1 # select @@have_innodb; + +# +# Bug #13334: query_prealloc_size default less than minimum +# +set @test = @@query_prealloc_size; +set @@query_prealloc_size = @test; +select @@query_prealloc_size = @test; + +# End of 4.1 tests diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a6a91ac32ee..4d5a85e3fdc 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5280,7 +5280,8 @@ The minimum value for this variable is 4096.", "Persistent buffer for query parsing and execution", (gptr*) &global_system_variables.query_prealloc_size, (gptr*) &max_system_variables.query_prealloc_size, 0, GET_ULONG, - REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, 16384, ~0L, 0, 1024, 0}, + REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE, + ~0L, 0, 1024, 0}, {"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE, "Allocation block size for storing ranges during optimization", (gptr*) &global_system_variables.range_alloc_block_size, From 8e1dac44b4636c7f8dd97fe9417c70c1894515c3 Mon Sep 17 00:00:00 2001 From: "jani@ua141d10.elisa.omakaista.fi" <> Date: Tue, 18 Oct 2005 18:03:26 +0300 Subject: [PATCH 3/3] Some fixes to avoid compiler warnings. --- mysql-test/my_manage.c | 5 ++++- mysql-test/mysql_test_run_new.c | 1 - sql/item_func.cc | 1 - strings/ctype-simple.c | 2 +- strings/ctype-ucs2.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mysql-test/my_manage.c b/mysql-test/my_manage.c index 88e68dfc27e..919d3bd0529 100644 --- a/mysql-test/my_manage.c +++ b/mysql-test/my_manage.c @@ -230,7 +230,10 @@ int wait_for_server_start(char *bin_dir __attribute__((unused)), char *user, char *password, int port,char *tmp_dir) { arg_list_t al; - int err= 0, i; + int err= 0; +#ifndef __WIN__ + int i; +#endif char trash[FN_REFLEN]; /* mysqladmin file */ diff --git a/mysql-test/mysql_test_run_new.c b/mysql-test/mysql_test_run_new.c index 40e45a92851..8beebefd298 100644 --- a/mysql-test/mysql_test_run_new.c +++ b/mysql-test/mysql_test_run_new.c @@ -1716,7 +1716,6 @@ int main(int argc, char **argv) int* handle; char test[FN_LEN]; char mask[FN_REFLEN]; - char *p; int position; /* single test */ diff --git a/sql/item_func.cc b/sql/item_func.cc index 288859443ff..df32672e12b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3252,7 +3252,6 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name, LEX_STRING component) { sys_var *var; - char buff[MAX_SYS_VAR_LENGTH*2+4+8], *pos; LEX_STRING *base_name, *component_name; if (component.str == 0 && diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index efddab621f2..095b2f3a4ac 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -867,7 +867,7 @@ int my_longlong10_to_str_8bit(CHARSET_INFO *cs __attribute__((unused)), while (long_val != 0) { long quo= long_val/10; - *--p = '0' + (long_val - quo*10); + *--p = (char) ('0' + (long_val - quo*10)); long_val= quo; } diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 56c05635300..ad07fd9903c 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1043,7 +1043,7 @@ int my_ll10tostr_ucs2(CHARSET_INFO *cs __attribute__((unused)), while (long_val != 0) { long quo= long_val/10; - *--p = '0' + (long_val - quo*10); + *--p = (char) ('0' + (long_val - quo*10)); long_val= quo; }