diff options
author | unknown <tsmith@quadxeon.mysql.com> | 2007-06-14 23:23:30 +0200 |
---|---|---|
committer | unknown <tsmith@quadxeon.mysql.com> | 2007-06-14 23:23:30 +0200 |
commit | cb93ff4d02ef0b0d3f4722572d8851da5ac9e1bb (patch) | |
tree | a2e6d7b3fecd15d53e148269e3dbb13aa08370b3 /sql | |
parent | 863a953e1d9621d03d17c4c347898a6d09d5aa6f (diff) | |
parent | dc6c3b31d8c50994ae0b7673ef55437c336daed4 (diff) | |
download | mariadb-git-cb93ff4d02ef0b0d3f4722572d8851da5ac9e1bb.tar.gz |
Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.0-build
into quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/jun14/50
configure.in:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/binlog.result:
Auto merged
mysql-test/r/have_log_bin.require:
Auto merged
BitKeeper/deleted/.del-ctype_cp932_notembedded.test:
Auto merged
mysql-test/t/binlog.test:
Auto merged
mysql-test/t/ctype_cp932_binlog.test:
Auto merged
mysql-test/t/ctype_ucs_binlog.test:
Auto merged
mysql-test/t/flush_block_commit_notembedded.test:
Auto merged
mysql-test/t/insert_select-binlog.test:
Auto merged
mysql-test/t/mysqlbinlog-cp932.test:
Auto merged
mysql-test/t/mysqldump.test:
Auto merged
mysql-test/t/sp_trans.test:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
mysql-test/r/mix_innodb_myisam_binlog.result:
Use local
mysql-test/t/blackhole.test:
manual merge
mysql-test/t/drop_temp_table.test:
manual merge
mysql-test/t/mix_innodb_myisam_binlog.test:
Use local
mysql-test/t/mysqlbinlog.test:
Use local
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_acl.cc | 13 | ||||
-rw-r--r-- | sql/sql_parse.cc | 10 | ||||
-rw-r--r-- | sql/sql_select.cc | 20 |
3 files changed, 27 insertions, 16 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ba6d03d6063..cae1f6eb243 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -978,14 +978,15 @@ bool acl_getroot_no_password(Security_context *sctx, char *user, char *host, */ for (i=0 ; i < acl_users.elements ; i++) { - acl_user= dynamic_element(&acl_users,i,ACL_USER*); - if ((!acl_user->user && !user[0]) || - (acl_user->user && strcmp(user, acl_user->user) == 0)) + ACL_USER *acl_user_tmp= dynamic_element(&acl_users,i,ACL_USER*); + if ((!acl_user_tmp->user && !user[0]) || + (acl_user_tmp->user && strcmp(user, acl_user_tmp->user) == 0)) { - if (compare_hostname(&acl_user->host, host, ip)) + if (compare_hostname(&acl_user_tmp->host, host, ip)) { - res= 0; - break; + acl_user= acl_user_tmp; + res= 0; + break; } } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c9baecd9cf1..cf8209978a3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1009,9 +1009,12 @@ static int check_connection(THD *thd) Old clients send null-terminated string as password; new clients send the size (1 byte) + string (not null-terminated). Hence in case of empty password both send '\0'. + + Cast *passwd to an unsigned char, so that it doesn't extend the sign for + *passwd > 127 and become 2**32-127 after casting to uint. */ uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? - *passwd++ : strlen(passwd); + (uchar)(*passwd++) : strlen(passwd); db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ? db + passwd_len + 1 : 0; uint db_len= db ? strlen(db) : 0; @@ -1697,11 +1700,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd, Old clients send null-terminated string ('\0' for empty string) for password. New clients send the size (1 byte) + string (not null terminated, so also '\0' for empty string). + + Cast *passwd to an unsigned char, so that it doesn't extend the sign + for *passwd > 127 and become 2**32-127 after casting to uint. */ char db_buff[NAME_LEN+1]; // buffer to store db in utf8 char *db= passwd; uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ? - *passwd++ : strlen(passwd); + (uchar)(*passwd++) : strlen(passwd); db+= passwd_len + 1; #ifndef EMBEDDED_LIBRARY /* Small check for incoming packet */ diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6bff302f7f8..36c0988021f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9164,7 +9164,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, bool using_unique_constraint= 0; bool use_packed_rows= 0; bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS); - char *tmpname,path[FN_REFLEN]; + char *tmpname, *tmppath, path[FN_REFLEN], table_name[NAME_LEN+1]; byte *pos,*group_buff; uchar *null_flags; Field **reg_field, **from_field, **default_field; @@ -9187,12 +9187,12 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, temp_pool_slot = bitmap_set_next(&temp_pool); if (temp_pool_slot != MY_BIT_NONE) // we got a slot - sprintf(path, "%s_%lx_%i", tmp_file_prefix, - current_pid, temp_pool_slot); + sprintf(table_name, "%s_%lx_%i", tmp_file_prefix, + current_pid, temp_pool_slot); else { /* if we run out of slots or we are not using tempool */ - sprintf(path,"%s%lx_%lx_%x", tmp_file_prefix,current_pid, + sprintf(table_name, "%s%lx_%lx_%x", tmp_file_prefix,current_pid, thd->thread_id, thd->tmp_table++); } @@ -9200,7 +9200,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, No need to change table name to lower case as we are only creating MyISAM or HEAP tables here */ - fn_format(path, path, mysql_tmpdir, "", MY_REPLACE_EXT|MY_UNPACK_FILENAME); + fn_format(path, table_name, mysql_tmpdir, "", + MY_REPLACE_EXT|MY_UNPACK_FILENAME); if (group) { @@ -9245,7 +9246,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, sizeof(*key_part_info)*(param->group_parts+1), ¶m->start_recinfo, sizeof(*param->recinfo)*(field_count*2+4), - &tmpname, (uint) strlen(path)+1, + &tmppath, (uint) strlen(path)+1, + &tmpname, (uint) strlen(table_name)+1, &group_buff, group && ! using_unique_constraint ? param->group_length : 0, NullS)) @@ -9263,7 +9265,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, DBUG_RETURN(NULL); /* purecov: inspected */ } param->items_to_copy= copy_func; - strmov(tmpname,path); + strmov(tmppath, path); + strmov(tmpname, table_name); /* make table according to fields */ bzero((char*) table,sizeof(*table)); @@ -9289,7 +9292,8 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, table->s= &table->share_not_to_be_used; table->s->blob_field= blob_field; - table->s->table_name= table->s->path= tmpname; + table->s->table_name= tmpname; + table->s->path= tmppath; table->s->db= ""; table->s->blob_ptr_size= mi_portable_sizeof_char_ptr; table->s->tmp_table= NON_TRANSACTIONAL_TMP_TABLE; |