diff options
author | jimw@mysql.com <> | 2005-07-05 15:23:13 -0700 |
---|---|---|
committer | jimw@mysql.com <> | 2005-07-05 15:23:13 -0700 |
commit | 2669b86612a0de9d8583434839786b4c26d2d8cf (patch) | |
tree | 8c64e4587ea98702778dca068bd5159cdb53c5be | |
parent | 81cf9394bfee5cae866743afcc97b6d3dee782d5 (diff) | |
parent | ac8f9d386412e1893e9e8f20aa821fa75ad78a2b (diff) | |
download | mariadb-git-2669b86612a0de9d8583434839786b4c26d2d8cf.tar.gz |
Merge mysql.com:/home/jimw/my/mysql-4.1-clean
into mysql.com:/home/jimw/my/mysql-5.0-clean
-rw-r--r-- | mysql-test/r/grant.result | 5 | ||||
-rw-r--r-- | mysql-test/t/grant.test | 9 | ||||
-rw-r--r-- | scripts/mysql_config.sh | 18 | ||||
-rw-r--r-- | sql/sql_acl.cc | 3 | ||||
-rw-r--r-- | sql/sql_table.cc | 10 |
5 files changed, 33 insertions, 12 deletions
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index d84c9317755..19982c7bb60 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -586,3 +586,8 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost; DROP USER dummy@localhost; DROP DATABASE mysqltest; +use mysql; +insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_grantor',CURRENT_TIMESTAMP,'Select','Select'); +flush privileges; +delete from tables_priv where host = '' and user = 'mysqltest_1'; +flush privileges; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index e4e0a8b4f1a..bb21873a0c4 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -470,3 +470,12 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost; DROP USER dummy@localhost; DROP DATABASE mysqltest; +# +# Bug #11330: Entry in tables_priv with host = '' causes crash +# +connection default; +use mysql; +insert into tables_priv values ('','test_db','mysqltest_1','test_table','test_grantor',CURRENT_TIMESTAMP,'Select','Select'); +flush privileges; +delete from tables_priv where host = '' and user = 'mysqltest_1'; +flush privileges; diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh index a5c8af5ecb2..16e50c044ca 100644 --- a/scripts/mysql_config.sh +++ b/scripts/mysql_config.sh @@ -60,11 +60,19 @@ fix_path () get_full_path () { - case $1 in - /*) echo "$1";; - ./*) tmp=`pwd`/$1; echo $tmp | sed -e 's;/\./;/;' ;; - *) which $1 ;; - esac + file=$1 + + # if the file is a symlink, try to resolve it + if [ -h $file ]; + then + file=`ls -l $file | awk '{ print $NF }'` + fi + + case $file in + /*) echo "$file";; + */*) tmp=`pwd`/$file; echo $tmp | sed -e 's;/\./;/;' ;; + *) which $file ;; + esac } me=`get_full_path $0` diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index c1044d31c46..a467478a012 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2035,7 +2035,8 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs) { uint key_prefix_len; KEY_PART_INFO *key_part= col_privs->key_info->key_part; - col_privs->field[0]->store(host.hostname,(uint) strlen(host.hostname), + col_privs->field[0]->store(host.hostname, + host.hostname ? (uint) strlen(host.hostname) : 0, system_charset_info); col_privs->field[1]->store(db,(uint) strlen(db), system_charset_info); col_privs->field[2]->store(user,(uint) strlen(user), system_charset_info); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0e6bd00d9c3..5a93176b922 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1550,14 +1550,12 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, /* Check if table exists */ if (create_info->options & HA_LEX_CREATE_TMP_TABLE) { - char tmp_table_name[tmp_file_prefix_length+22+22+22+3]; - my_snprintf(tmp_table_name, sizeof(tmp_table_name), "%s%lx_%lx_%x", - tmp_file_prefix, current_pid, thd->thread_id, - thd->tmp_table++); + my_snprintf(path, sizeof(path), "%s%s%lx_%lx_%x%s", + mysql_tmpdir, tmp_file_prefix, current_pid, thd->thread_id, + thd->tmp_table++, reg_ext); if (lower_case_table_names) - my_casedn_str(files_charset_info, tmp_table_name); + my_casedn_str(files_charset_info, path); create_info->table_options|=HA_CREATE_DELAY_KEY_WRITE; - build_table_path(path, sizeof(path), db, tmp_table_name, reg_ext); } else build_table_path(path, sizeof(path), db, alias, reg_ext); |