mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bugs#17647: Trouble with "create database"
Problem: if a user was granted privileges on database "d1", it also was able to act on "D1" (i.e. in upper case), even on Unix with case sensitive file system. Fix: Initialize grant hash to use binary comparison if lower_case_file_system is not set (on most unixes), and case insensitive comparison otherwise (Windows, MacOSX).
This commit is contained in:
4
mysql-test/include/have_case_sensitive_file_system.inc
Normal file
4
mysql-test/include/have_case_sensitive_file_system.inc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
--require r/case_sensitive_file_system.require
|
||||||
|
--disable_query_log
|
||||||
|
show variables like "lower_case_file_system";
|
||||||
|
--enable_query_log
|
2
mysql-test/r/case_sensitive_file_system.require
Normal file
2
mysql-test/r/case_sensitive_file_system.require
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Variable_name Value
|
||||||
|
lower_case_file_system OFF
|
11
mysql-test/r/lowercase_fs_off.result
Normal file
11
mysql-test/r/lowercase_fs_off.result
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
create database d1;
|
||||||
|
grant all on d1.* to 'sample'@'localhost' identified by 'password';
|
||||||
|
flush privileges;
|
||||||
|
select database();
|
||||||
|
database()
|
||||||
|
d1
|
||||||
|
create database d2;
|
||||||
|
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'd2'
|
||||||
|
create database D1;
|
||||||
|
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1'
|
||||||
|
drop database if exists d1;
|
27
mysql-test/t/lowercase_fs_off.test
Normal file
27
mysql-test/t/lowercase_fs_off.test
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#
|
||||||
|
# Specific tests for case sensitive file systems
|
||||||
|
# i.e. lower_case_filesystem=OFF
|
||||||
|
#
|
||||||
|
-- source include/have_case_sensitive_file_system.inc
|
||||||
|
|
||||||
|
connect (master,localhost,root,,);
|
||||||
|
connection master;
|
||||||
|
create database d1;
|
||||||
|
grant all on d1.* to 'sample'@'localhost' identified by 'password';
|
||||||
|
flush privileges;
|
||||||
|
|
||||||
|
connect (sample,localhost,sample,password,d1);
|
||||||
|
connection sample;
|
||||||
|
select database();
|
||||||
|
--error 1044
|
||||||
|
create database d2;
|
||||||
|
--error 1044
|
||||||
|
create database D1;
|
||||||
|
disconnect sample;
|
||||||
|
|
||||||
|
connection master;
|
||||||
|
drop database if exists d1;
|
||||||
|
disconnect master;
|
||||||
|
connection default;
|
||||||
|
|
||||||
|
# End of 4.1 tests
|
@ -146,7 +146,9 @@ my_bool acl_init(bool dont_read_acl_tables)
|
|||||||
|
|
||||||
acl_cache= new hash_filo(ACL_CACHE_SIZE, 0, 0,
|
acl_cache= new hash_filo(ACL_CACHE_SIZE, 0, 0,
|
||||||
(hash_get_key) acl_entry_get_key,
|
(hash_get_key) acl_entry_get_key,
|
||||||
(hash_free_key) free, system_charset_info);
|
(hash_free_key) free,
|
||||||
|
lower_case_file_system ?
|
||||||
|
system_charset_info : &my_charset_bin);
|
||||||
if (dont_read_acl_tables)
|
if (dont_read_acl_tables)
|
||||||
{
|
{
|
||||||
DBUG_RETURN(0); /* purecov: tested */
|
DBUG_RETURN(0); /* purecov: tested */
|
||||||
|
Reference in New Issue
Block a user