Below is the list of changes that have just been committed into a local
4.1 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2167 05/02/15 13:36:46 jimw@stripped +4 -0
Always lowercase database names from 'host' and 'db' grant tables when they
are loaded and lower_case_table_names is set, but issue a warning when it is
done. (Bug #7989)
sql/sql_acl.cc
1.158 05/02/15 12:28:57 jimw@stripped +31 -2
Lowercase database names in 'host' and 'db' grant tables when loading,
but issue a warning to the log about them.
mysql-test/r/lowercase_table_grant.result
1.1 05/02/15 12:28:48 jimw@stripped +23 -0
mysql-test/r/lowercase_table_grant.result
1.0 05/02/15 12:28:48 jimw@stripped +0 -0
BitKeeper file /home/jimw/my/mysql-4.1-7989/mysql-test/r/lowercase_table_grant.result
mysql-test/t/lowercase_table_grant.test
1.1 05/02/15 12:28:40 jimw@stripped +25 -0
mysql-test/t/lowercase_table_grant-master.opt
1.1 05/02/15 12:28:40 jimw@stripped +1 -0
mysql-test/t/lowercase_table_grant.test
1.0 05/02/15 12:28:40 jimw@stripped +0 -0
BitKeeper file /home/jimw/my/mysql-4.1-7989/mysql-test/t/lowercase_table_grant.test
mysql-test/t/lowercase_table_grant-master.opt
1.0 05/02/15 12:28:40 jimw@stripped +0 -0
BitKeeper file /home/jimw/my/mysql-4.1-7989/mysql-test/t/lowercase_table_grant-master.opt
sql/sql_acl.cc
1.157 05/02/14 18:57:39 jimw@stripped +8 -0
When lower_case_table_names is set, lowercase the database names read
from the grant tables.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jimw
# Host: rama.(none)
# Root: /home/jimw/my/mysql-4.1-7989
--- 1.156/sql/sql_acl.cc 2005-01-24 06:48:17 -08:00
+++ 1.158/sql/sql_acl.cc 2005-02-15 12:28:57 -08:00
@@ -139,6 +139,7 @@
MYSQL_LOCK *lock;
my_bool return_val=1;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
+ char tmp_name[NAME_LEN+1];
DBUG_ENTER("acl_init");
@@ -197,6 +198,24 @@
ACL_HOST host;
update_hostname(&host.host,get_field(&mem, table->field[0]));
host.db= get_field(&mem, table->field[1]);
+ if (lower_case_table_names)
+ {
+ /*
+ We make a temporary copy of the database, force it to lower case,
+ and then copy it back over the original name. We can't just update
+ the host.db pointer, because tmp_name is allocated on the stack.
+ */
+ (void)strmov(tmp_name, host.db);
+ my_casedn_str(files_charset_info, tmp_name);
+ if (strcmp(host.db, tmp_name) != 0)
+ {
+ sql_print_warning("'host' entry '%s|%s' had database in mixed "
+ "case that has been forced to lowercase because "
+ "lower_case_table_names is set.",
+ host.host.hostname, host.db);
+ (void)strmov(host.db, tmp_name);
+ }
+ }
host.access= get_access(table,2);
host.access= fix_rights_for_db(host.access);
host.sort= get_sort(2,host.host.hostname,host.db);
@@ -380,6 +399,24 @@
}
db.access=get_access(table,3);
db.access=fix_rights_for_db(db.access);
+ if (lower_case_table_names)
+ {
+ /*
+ We make a temporary copy of the database, force it to lower case,
+ and then copy it back over the original name. We can't just update
+ the db.db pointer, because tmp_name is allocated on the stack.
+ */
+ (void)strmov(tmp_name, db.db);
+ my_casedn_str(files_charset_info, tmp_name);
+ if (strcmp(db.db, tmp_name) != 0)
+ {
+ sql_print_warning("'db' entry '%s %s@%s' had database in mixed "
+ "case that has been forced to lowercase because "
+ "lower_case_table_names is set.",
+ db.db, db.user, db.host.hostname, db.host.hostname);
+ (void)strmov(db.db, tmp_name);
+ }
+ }
db.sort=get_sort(3,db.host.hostname,db.db,db.user);
#ifndef TO_BE_REMOVED
if (table->fields <= 9)
--- New file ---
+++ mysql-test/r/lowercase_table_grant.result 05/02/15 12:28:48
use mysql;
create database MYSQLtest;
grant all on MySQLtest.* to mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
select * from db where user = 'mysqltest_1';
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv
localhost mysqltest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y
update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost';
flush privileges;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
select * from db where user = 'mysqltest_1';
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv
localhost MYSQLtest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y
delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost';
flush privileges;
drop user mysqltest_1@localhost;
drop database MYSQLtest;
--- New file ---
+++ mysql-test/t/lowercase_table_grant-master.opt 05/02/15 12:28:40
--lower_case_table_names
--- New file ---
+++ mysql-test/t/lowercase_table_grant.test 05/02/15 12:28:40
# Test of grants when lower_case_table_names is on
use mysql;
# mixed-case database name for testing
create database MYSQLtest;
# check that database name gets forced to lowercase
grant all on MySQLtest.* to mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
# now force it to mixed case, but see that it is lowercased in the acl cache
select * from db where user = 'mysqltest_1';
update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost';
flush privileges;
show grants for mysqltest_1@localhost;
select * from db where user = 'mysqltest_1';
# clear out the user we created
#
# can't use REVOKE because of the mixed-case database name
delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost';
flush privileges;
drop user mysqltest_1@localhost;
drop database MYSQLtest;
| Thread |
|---|
| • bk commit into 4.1 tree (jimw:1.2167) BUG#7989 | Jim Winstead | 15 Feb |