Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
754dee8e
Commit
754dee8e
authored
Oct 27, 2009
by
Tatiana A. Nurnberg
Browse files
Options
Browse Files
Download
Plain Diff
auto-merge
parents
0ba101d4
b611592b
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
196 additions
and
85 deletions
+196
-85
mysql-test/include/have_case_insensitive_fs.inc
mysql-test/include/have_case_insensitive_fs.inc
+4
-0
mysql-test/r/case_insensitive_fs.require
mysql-test/r/case_insensitive_fs.require
+2
-0
mysql-test/r/grant.result
mysql-test/r/grant.result
+2
-2
mysql-test/r/grant_lowercase_fs.result
mysql-test/r/grant_lowercase_fs.result
+16
-0
mysql-test/r/lowercase_fs_off.result
mysql-test/r/lowercase_fs_off.result
+45
-0
mysql-test/r/ps_grant.result
mysql-test/r/ps_grant.result
+3
-3
mysql-test/r/system_mysql_db.result
mysql-test/r/system_mysql_db.result
+1
-1
mysql-test/t/grant_lowercase_fs.test
mysql-test/t/grant_lowercase_fs.test
+30
-0
mysql-test/t/lowercase_fs_off.test
mysql-test/t/lowercase_fs_off.test
+62
-0
scripts/mysql_system_tables.sql
scripts/mysql_system_tables.sql
+1
-1
scripts/mysql_system_tables_fix.sql
scripts/mysql_system_tables_fix.sql
+4
-0
sql/sql_acl.cc
sql/sql_acl.cc
+24
-19
vio/viosslfactories.c
vio/viosslfactories.c
+2
-59
No files found.
mysql-test/include/have_case_insensitive_fs.inc
0 → 100644
View file @
754dee8e
--
require
r
/
case_insensitive_fs
.
require
--
disable_query_log
show
variables
like
'lower_case_file_system'
;
--
enable_query_log
mysql-test/r/case_insensitive_fs.require
0 → 100644
View file @
754dee8e
Variable_name Value
lower_case_file_system ON
mysql-test/r/grant.result
View file @
754dee8e
...
...
@@ -1007,8 +1007,8 @@ DROP TABLE mysqltest1.t2;
SHOW GRANTS;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
RENAME TABLE t1 TO t2;
RENAME TABLE t2 TO t1;
ALTER TABLE t1 RENAME TO t2;
...
...
@@ -1018,8 +1018,8 @@ REVOKE DROP, INSERT ON mysqltest1.t2 FROM mysqltest_1@localhost;
SHOW GRANTS;
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
RENAME TABLE t1 TO t2;
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
ALTER TABLE t1 RENAME TO t2;
...
...
mysql-test/r/grant_lowercase_fs.result
0 → 100644
View file @
754dee8e
create database db1;
GRANT CREATE ON db1.* to user_1@localhost;
GRANT SELECT ON db1.* to USER_1@localhost;
CREATE TABLE t1(f1 int);
SELECT * FROM t1;
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
SELECT * FROM t1;
f1
CREATE TABLE t2(f1 int);
ERROR 42000: CREATE command denied to user 'USER_1'@'localhost' for table 't2'
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
DROP USER user_1@localhost;
DROP USER USER_1@localhost;
DROP DATABASE db1;
use test;
mysql-test/r/lowercase_fs_off.result
View file @
754dee8e
...
...
@@ -10,3 +10,48 @@ create database D1;
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1'
drop user 'sample'@'localhost';
drop database if exists d1;
CREATE DATABASE d1;
USE d1;
CREATE TABLE T1(f1 INT);
CREATE TABLE t1(f1 INT);
GRANT SELECT ON T1 to user_1@localhost;
select * from t1;
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
select * from T1;
f1
GRANT SELECT ON t1 to user_1@localhost;
select * from information_schema.table_privileges;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
'user_1'@'localhost' NULL d1 T1 SELECT NO
'user_1'@'localhost' NULL d1 t1 SELECT NO
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
DROP USER user_1@localhost;
DROP DATABASE d1;
USE test;
CREATE DATABASE db1;
USE db1;
CREATE PROCEDURE p1() BEGIN END;
CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
GRANT USAGE ON db1.* to user_1@localhost;
GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
GRANT UPDATE ON db1.* to USER_1@localhost;
call p1();
call P1();
select f1(1);
f1(1)
2
call p1();
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
call P1();
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
select f1(1);
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.f1'
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
DROP FUNCTION f1;
DROP PROCEDURE p1;
DROP USER user_1@localhost;
DROP USER USER_1@localhost;
DROP DATABASE db1;
use test;
mysql-test/r/ps_grant.result
View file @
754dee8e
...
...
@@ -32,19 +32,19 @@ identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
drop table mysqltest.t9 ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
prepare s_t1 from 'select a as my_col from t1' ;
execute s_t1 ;
my_col
...
...
mysql-test/r/system_mysql_db.result
View file @
754dee8e
...
...
@@ -161,7 +161,7 @@ procs_priv CREATE TABLE `procs_priv` (
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
`Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
`Routine_name` char(64) C
OLLATE utf8_bin
NOT NULL DEFAULT '',
`Routine_name` char(64) C
HARACTER SET utf8
NOT NULL DEFAULT '',
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
...
...
mysql-test/t/grant_lowercase_fs.test
0 → 100644
View file @
754dee8e
--
source
include
/
have_case_insensitive_fs
.
inc
--
source
include
/
not_embedded
.
inc
#
# Bug#41049 does syntax "grant" case insensitive?
#
create
database
db1
;
GRANT
CREATE
ON
db1
.*
to
user_1
@
localhost
;
GRANT
SELECT
ON
db1
.*
to
USER_1
@
localhost
;
connect
(
con1
,
localhost
,
user_1
,,
db1
);
CREATE
TABLE
t1
(
f1
int
);
--
error
1142
SELECT
*
FROM
t1
;
connect
(
con2
,
localhost
,
USER_1
,,
db1
);
SELECT
*
FROM
t1
;
--
error
1142
CREATE
TABLE
t2
(
f1
int
);
connection
default
;
disconnect
con1
;
disconnect
con2
;
REVOKE
ALL
PRIVILEGES
,
GRANT
OPTION
FROM
user_1
@
localhost
;
REVOKE
ALL
PRIVILEGES
,
GRANT
OPTION
FROM
USER_1
@
localhost
;
DROP
USER
user_1
@
localhost
;
DROP
USER
USER_1
@
localhost
;
DROP
DATABASE
db1
;
use
test
;
mysql-test/t/lowercase_fs_off.test
View file @
754dee8e
...
...
@@ -29,3 +29,65 @@ disconnect master;
connection
default
;
# End of 4.1 tests
#
# Bug#41049 does syntax "grant" case insensitive?
#
CREATE
DATABASE
d1
;
USE
d1
;
CREATE
TABLE
T1
(
f1
INT
);
CREATE
TABLE
t1
(
f1
INT
);
GRANT
SELECT
ON
T1
to
user_1
@
localhost
;
connect
(
con1
,
localhost
,
user_1
,,
d1
);
--
error
ER_TABLEACCESS_DENIED_ERROR
select
*
from
t1
;
select
*
from
T1
;
connection
default
;
GRANT
SELECT
ON
t1
to
user_1
@
localhost
;
connection
con1
;
select
*
from
information_schema
.
table_privileges
;
connection
default
;
disconnect
con1
;
REVOKE
ALL
PRIVILEGES
,
GRANT
OPTION
FROM
user_1
@
localhost
;
DROP
USER
user_1
@
localhost
;
DROP
DATABASE
d1
;
USE
test
;
CREATE
DATABASE
db1
;
USE
db1
;
CREATE
PROCEDURE
p1
()
BEGIN
END
;
CREATE
FUNCTION
f1
(
i
INT
)
RETURNS
INT
RETURN
i
+
1
;
GRANT
USAGE
ON
db1
.*
to
user_1
@
localhost
;
GRANT
EXECUTE
ON
PROCEDURE
db1
.
P1
to
user_1
@
localhost
;
GRANT
EXECUTE
ON
FUNCTION
db1
.
f1
to
user_1
@
localhost
;
GRANT
UPDATE
ON
db1
.*
to
USER_1
@
localhost
;
connect
(
con1
,
localhost
,
user_1
,,
db1
);
call
p1
();
call
P1
();
select
f1
(
1
);
connect
(
con2
,
localhost
,
USER_1
,,
db1
);
--
error
ER_PROCACCESS_DENIED_ERROR
call
p1
();
--
error
ER_PROCACCESS_DENIED_ERROR
call
P1
();
--
error
ER_PROCACCESS_DENIED_ERROR
select
f1
(
1
);
connection
default
;
disconnect
con1
;
disconnect
con2
;
REVOKE
ALL
PRIVILEGES
,
GRANT
OPTION
FROM
user_1
@
localhost
;
REVOKE
ALL
PRIVILEGES
,
GRANT
OPTION
FROM
USER_1
@
localhost
;
DROP
FUNCTION
f1
;
DROP
PROCEDURE
p1
;
DROP
USER
user_1
@
localhost
;
DROP
USER
USER_1
@
localhost
;
DROP
DATABASE
db1
;
use
test
;
# End of 5.0 tests
scripts/mysql_system_tables.sql
View file @
754dee8e
...
...
@@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint sign
CREATE
TABLE
IF
NOT
EXISTS
proc
(
db
char
(
64
)
collate
utf8_bin
DEFAULT
''
NOT
NULL
,
name
char
(
64
)
DEFAULT
''
NOT
NULL
,
type
enum
(
'FUNCTION'
,
'PROCEDURE'
)
NOT
NULL
,
specific_name
char
(
64
)
DEFAULT
''
NOT
NULL
,
language
enum
(
'SQL'
)
DEFAULT
'SQL'
NOT
NULL
,
sql_data_access
enum
(
'CONTAINS_SQL'
,
'NO_SQL'
,
'READS_SQL_DATA'
,
'MODIFIES_SQL_DATA'
)
DEFAULT
'CONTAINS_SQL'
NOT
NULL
,
is_deterministic
enum
(
'YES'
,
'NO'
)
DEFAULT
'NO'
NOT
NULL
,
security_type
enum
(
'INVOKER'
,
'DEFINER'
)
DEFAULT
'DEFINER'
NOT
NULL
,
param_list
blob
NOT
NULL
,
returns
longblob
DEFAULT
''
NOT
NULL
,
body
longblob
NOT
NULL
,
definer
char
(
77
)
collate
utf8_bin
DEFAULT
''
NOT
NULL
,
created
timestamp
,
modified
timestamp
,
sql_mode
set
(
'REAL_AS_FLOAT'
,
'PIPES_AS_CONCAT'
,
'ANSI_QUOTES'
,
'IGNORE_SPACE'
,
'NOT_USED'
,
'ONLY_FULL_GROUP_BY'
,
'NO_UNSIGNED_SUBTRACTION'
,
'NO_DIR_IN_CREATE'
,
'POSTGRESQL'
,
'ORACLE'
,
'MSSQL'
,
'DB2'
,
'MAXDB'
,
'NO_KEY_OPTIONS'
,
'NO_TABLE_OPTIONS'
,
'NO_FIELD_OPTIONS'
,
'MYSQL323'
,
'MYSQL40'
,
'ANSI'
,
'NO_AUTO_VALUE_ON_ZERO'
,
'NO_BACKSLASH_ESCAPES'
,
'STRICT_TRANS_TABLES'
,
'STRICT_ALL_TABLES'
,
'NO_ZERO_IN_DATE'
,
'NO_ZERO_DATE'
,
'INVALID_DATES'
,
'ERROR_FOR_DIVISION_BY_ZERO'
,
'TRADITIONAL'
,
'NO_AUTO_CREATE_USER'
,
'HIGH_NOT_PRECEDENCE'
,
'NO_ENGINE_SUBSTITUTION'
,
'PAD_CHAR_TO_FULL_LENGTH'
)
DEFAULT
''
NOT
NULL
,
comment
char
(
64
)
collate
utf8_bin
DEFAULT
''
NOT
NULL
,
character_set_client
char
(
32
)
collate
utf8_bin
,
collation_connection
char
(
32
)
collate
utf8_bin
,
db_collation
char
(
32
)
collate
utf8_bin
,
body_utf8
longblob
,
PRIMARY
KEY
(
db
,
name
,
type
))
engine
=
MyISAM
character
set
utf8
comment
=
'Stored Procedures'
;
CREATE
TABLE
IF
NOT
EXISTS
procs_priv
(
Host
char
(
60
)
binary
DEFAULT
''
NOT
NULL
,
Db
char
(
64
)
binary
DEFAULT
''
NOT
NULL
,
User
char
(
16
)
binary
DEFAULT
''
NOT
NULL
,
Routine_name
char
(
64
)
binary
DEFAULT
''
NOT
NULL
,
Routine_type
enum
(
'FUNCTION'
,
'PROCEDURE'
)
NOT
NULL
,
Grantor
char
(
77
)
DEFAULT
''
NOT
NULL
,
Proc_priv
set
(
'Execute'
,
'Alter Routine'
,
'Grant'
)
COLLATE
utf8_general_ci
DEFAULT
''
NOT
NULL
,
Timestamp
timestamp
(
14
),
PRIMARY
KEY
(
Host
,
Db
,
User
,
Routine_name
,
Routine_type
),
KEY
Grantor
(
Grantor
)
)
engine
=
MyISAM
CHARACTER
SET
utf8
COLLATE
utf8_bin
comment
=
'Procedure privileges'
;
CREATE
TABLE
IF
NOT
EXISTS
procs_priv
(
Host
char
(
60
)
binary
DEFAULT
''
NOT
NULL
,
Db
char
(
64
)
binary
DEFAULT
''
NOT
NULL
,
User
char
(
16
)
binary
DEFAULT
''
NOT
NULL
,
Routine_name
char
(
64
)
COLLATE
utf8_general_ci
DEFAULT
''
NOT
NULL
,
Routine_type
enum
(
'FUNCTION'
,
'PROCEDURE'
)
NOT
NULL
,
Grantor
char
(
77
)
DEFAULT
''
NOT
NULL
,
Proc_priv
set
(
'Execute'
,
'Alter Routine'
,
'Grant'
)
COLLATE
utf8_general_ci
DEFAULT
''
NOT
NULL
,
Timestamp
timestamp
(
14
),
PRIMARY
KEY
(
Host
,
Db
,
User
,
Routine_name
,
Routine_type
),
KEY
Grantor
(
Grantor
)
)
engine
=
MyISAM
CHARACTER
SET
utf8
COLLATE
utf8_bin
comment
=
'Procedure privileges'
;
-- Create general_log if CSV is enabled.
...
...
scripts/mysql_system_tables_fix.sql
View file @
754dee8e
...
...
@@ -337,6 +337,10 @@ ALTER TABLE procs_priv
MODIFY
Proc_priv
set
(
'Execute'
,
'Alter Routine'
,
'Grant'
)
COLLATE
utf8_general_ci
DEFAULT
''
NOT
NULL
;
ALTER
IGNORE
TABLE
procs_priv
MODIFY
Routine_name
char
(
64
)
COLLATE
utf8_general_ci
DEFAULT
''
NOT
NULL
;
ALTER
TABLE
procs_priv
ADD
Routine_type
enum
(
'FUNCTION'
,
'PROCEDURE'
)
COLLATE
utf8_general_ci
NOT
NULL
AFTER
Routine_name
;
...
...
sql/sql_acl.cc
View file @
754dee8e
...
...
@@ -263,8 +263,7 @@ my_bool acl_init(bool dont_read_acl_tables)
acl_cache
=
new
hash_filo
(
ACL_CACHE_SIZE
,
0
,
0
,
(
hash_get_key
)
acl_entry_get_key
,
(
hash_free_key
)
free
,
lower_case_file_system
?
system_charset_info
:
&
my_charset_bin
);
&
my_charset_utf8_bin
);
if
(
dont_read_acl_tables
)
{
DBUG_RETURN
(
0
);
/* purecov: tested */
...
...
@@ -2251,12 +2250,13 @@ class GRANT_NAME :public Sql_alloc
ulong
sort
;
size_t
key_length
;
GRANT_NAME
(
const
char
*
h
,
const
char
*
d
,
const
char
*
u
,
const
char
*
t
,
ulong
p
);
GRANT_NAME
(
TABLE
*
form
);
const
char
*
t
,
ulong
p
,
bool
is_routine
);
GRANT_NAME
(
TABLE
*
form
,
bool
is_routine
);
virtual
~
GRANT_NAME
()
{};
virtual
bool
ok
()
{
return
privs
!=
0
;
}
void
set_user_details
(
const
char
*
h
,
const
char
*
d
,
const
char
*
u
,
const
char
*
t
);
const
char
*
u
,
const
char
*
t
,
bool
is_routine
);
};
...
...
@@ -2275,7 +2275,8 @@ class GRANT_TABLE :public GRANT_NAME
void
GRANT_NAME
::
set_user_details
(
const
char
*
h
,
const
char
*
d
,
const
char
*
u
,
const
char
*
t
)
const
char
*
u
,
const
char
*
t
,
bool
is_routine
)
{
/* Host given by user */
update_hostname
(
&
host
,
strdup_root
(
&
memex
,
h
));
...
...
@@ -2290,7 +2291,7 @@ void GRANT_NAME::set_user_details(const char *h, const char *d,
if
(
tname
!=
t
)
{
tname
=
strdup_root
(
&
memex
,
t
);
if
(
lower_case_table_names
)
if
(
lower_case_table_names
||
is_routine
)
my_casedn_str
(
files_charset_info
,
tname
);
}
key_length
=
strlen
(
d
)
+
strlen
(
u
)
+
strlen
(
t
)
+
3
;
...
...
@@ -2299,22 +2300,22 @@ void GRANT_NAME::set_user_details(const char *h, const char *d,
}
GRANT_NAME
::
GRANT_NAME
(
const
char
*
h
,
const
char
*
d
,
const
char
*
u
,
const
char
*
t
,
ulong
p
)
const
char
*
t
,
ulong
p
,
bool
is_routine
)
:
db
(
0
),
tname
(
0
),
privs
(
p
)
{
set_user_details
(
h
,
d
,
u
,
t
);
set_user_details
(
h
,
d
,
u
,
t
,
is_routine
);
}
GRANT_TABLE
::
GRANT_TABLE
(
const
char
*
h
,
const
char
*
d
,
const
char
*
u
,
const
char
*
t
,
ulong
p
,
ulong
c
)
:
GRANT_NAME
(
h
,
d
,
u
,
t
,
p
),
cols
(
c
)
:
GRANT_NAME
(
h
,
d
,
u
,
t
,
p
,
FALSE
),
cols
(
c
)
{
(
void
)
hash_init2
(
&
hash_columns
,
4
,
system_charset_info
,
0
,
0
,
0
,
(
hash_get_key
)
get_key_column
,
0
,
0
);
}
GRANT_NAME
::
GRANT_NAME
(
TABLE
*
form
)
GRANT_NAME
::
GRANT_NAME
(
TABLE
*
form
,
bool
is_routine
)
{
update_hostname
(
&
host
,
get_field
(
&
memex
,
form
->
field
[
0
]));
db
=
get_field
(
&
memex
,
form
->
field
[
1
]);
...
...
@@ -2332,6 +2333,9 @@ GRANT_NAME::GRANT_NAME(TABLE *form)
if
(
lower_case_table_names
)
{
my_casedn_str
(
files_charset_info
,
db
);
}
if
(
lower_case_table_names
||
is_routine
)
{
my_casedn_str
(
files_charset_info
,
tname
);
}
key_length
=
(
strlen
(
db
)
+
strlen
(
user
)
+
strlen
(
tname
)
+
3
);
...
...
@@ -2343,7 +2347,7 @@ GRANT_NAME::GRANT_NAME(TABLE *form)
GRANT_TABLE
::
GRANT_TABLE
(
TABLE
*
form
,
TABLE
*
col_privs
)
:
GRANT_NAME
(
form
)
:
GRANT_NAME
(
form
,
FALSE
)
{
uchar
key
[
MAX_KEY_LENGTH
];
...
...
@@ -3338,7 +3342,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
}
grant_name
=
new
GRANT_NAME
(
Str
->
host
.
str
,
db_name
,
Str
->
user
.
str
,
table_name
,
rights
);
rights
,
TRUE
);
if
(
!
grant_name
)
{
result
=
TRUE
;
...
...
@@ -3549,10 +3553,10 @@ static my_bool grant_load_procs_priv(TABLE *p_table)
MEM_ROOT
**
save_mem_root_ptr
=
my_pthread_getspecific_ptr
(
MEM_ROOT
**
,
THR_MALLOC
);
DBUG_ENTER
(
"grant_load_procs_priv"
);
(
void
)
hash_init
(
&
proc_priv_hash
,
system_charset_info
,
(
void
)
hash_init
(
&
proc_priv_hash
,
&
my_charset_utf8_bin
,
0
,
0
,
0
,
(
hash_get_key
)
get_grant_table
,
0
,
0
);
(
void
)
hash_init
(
&
func_priv_hash
,
system_charset_info
,
(
void
)
hash_init
(
&
func_priv_hash
,
&
my_charset_utf8_bin
,
0
,
0
,
0
,
(
hash_get_key
)
get_grant_table
,
0
,
0
);
p_table
->
file
->
ha_index_init
(
0
,
1
);
...
...
@@ -3566,7 +3570,7 @@ static my_bool grant_load_procs_priv(TABLE *p_table)
{
GRANT_NAME
*
mem_check
;
HASH
*
hash
;
if
(
!
(
mem_check
=
new
(
memex_ptr
)
GRANT_NAME
(
p_table
)))
if
(
!
(
mem_check
=
new
(
memex_ptr
)
GRANT_NAME
(
p_table
,
TRUE
)))
{
/* This could only happen if we are out memory */
goto
end_unlock
;
...
...
@@ -3650,7 +3654,7 @@ static my_bool grant_load(THD *thd, TABLE_LIST *tables)
thd
->
variables
.
sql_mode
&=
~
MODE_PAD_CHAR_TO_FULL_LENGTH
;
(
void
)
hash_init
(
&
column_priv_hash
,
system_charset_info
,
(
void
)
hash_init
(
&
column_priv_hash
,
&
my_charset_utf8_bin
,
0
,
0
,
0
,
(
hash_get_key
)
get_grant_table
,
(
hash_free_key
)
free_grant_table
,
0
);
...
...
@@ -5452,7 +5456,8 @@ static int handle_grant_struct(uint struct_no, bool drop,
host name
*/
grant_name
->
set_user_details
(
user_to
->
host
.
str
,
grant_name
->
db
,
user_to
->
user
.
str
,
grant_name
->
tname
);
user_to
->
user
.
str
,
grant_name
->
tname
,
TRUE
);
/*
Since username is part of the hash key, when the user name
...
...
@@ -6139,7 +6144,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
for
(
counter
=
0
,
revoked
=
0
;
counter
<
hash
->
records
;
)
{
GRANT_NAME
*
grant_proc
=
(
GRANT_NAME
*
)
hash_element
(
hash
,
counter
);
if
(
!
my_strcasecmp
(
system_charset_info
,
grant_proc
->
db
,
sp_db
)
&&
if
(
!
my_strcasecmp
(
&
my_charset_utf8_bin
,
grant_proc
->
db
,
sp_db
)
&&
!
my_strcasecmp
(
system_charset_info
,
grant_proc
->
tname
,
sp_name
))
{
LEX_USER
lex_user
;
...
...
vio/viosslfactories.c
View file @
754dee8e
...
...
@@ -144,55 +144,6 @@ vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file, const char *key_file,
}
static
int
vio_verify_callback
(
int
ok
,
X509_STORE_CTX
*
ctx
)
{
char
buf
[
256
];
X509
*
err_cert
;
DBUG_ENTER
(
"vio_verify_callback"
);
DBUG_PRINT
(
"enter"
,
(
"ok: %d ctx: 0x%lx"
,
ok
,
(
long
)
ctx
));
err_cert
=
X509_STORE_CTX_get_current_cert
(
ctx
);
X509_NAME_oneline
(
X509_get_subject_name
(
err_cert
),
buf
,
sizeof
(
buf
));
DBUG_PRINT
(
"info"
,
(
"cert: %s"
,
buf
));
if
(
!
ok
)
{
int
err
,
depth
;
err
=
X509_STORE_CTX_get_error
(
ctx
);
depth
=
X509_STORE_CTX_get_error_depth
(
ctx
);
DBUG_PRINT
(
"error"
,(
"verify error: %d '%s'"
,
err
,
X509_verify_cert_error_string
(
err
)));
/*
Approve cert if depth is greater then "verify_depth", currently
verify_depth is always 0 and there is no way to increase it.
*/
if
(
verify_depth
>=
depth
)
ok
=
1
;
}
switch
(
ctx
->
error
)
{
case
X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
:
X509_NAME_oneline
(
X509_get_issuer_name
(
ctx
->
current_cert
),
buf
,
256
);
DBUG_PRINT
(
"info"
,(
"issuer= %s
\n
"
,
buf
));
break
;
case
X509_V_ERR_CERT_NOT_YET_VALID
:
case
X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD
:
DBUG_PRINT
(
"error"
,
(
"notBefore"
));
/*ASN1_TIME_print_fp(stderr,X509_get_notBefore(ctx->current_cert));*/
break
;
case
X509_V_ERR_CERT_HAS_EXPIRED
:
case
X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD
:
DBUG_PRINT
(
"error"
,
(
"notAfter error"
));
/*ASN1_TIME_print_fp(stderr,X509_get_notAfter(ctx->current_cert));*/
break
;
}
DBUG_PRINT
(
"exit"
,
(
"%d"
,
ok
));
DBUG_RETURN
(
ok
);
}
#ifdef __NETWARE__
/* NetWare SSL cleanup */
...
...
@@ -354,11 +305,7 @@ new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
/* Init the VioSSLFd as a "connector" ie. the client side */
/*
The verify_callback function is used to control the behaviour
when the SSL_VERIFY_PEER flag is set.
*/
SSL_CTX_set_verify
(
ssl_fd
->
ssl_context
,
verify
,
vio_verify_callback
);
SSL_CTX_set_verify
(
ssl_fd
->
ssl_context
,
verify
,
NULL
);
return
ssl_fd
;
}
...
...
@@ -382,11 +329,7 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
/* Set max number of cached sessions, returns the previous size */
SSL_CTX_sess_set_cache_size
(
ssl_fd
->
ssl_context
,
128
);
/*
The verify_callback function is used to control the behaviour
when the SSL_VERIFY_PEER flag is set.
*/
SSL_CTX_set_verify
(
ssl_fd
->
ssl_context
,
verify
,
vio_verify_callback
);
SSL_CTX_set_verify
(
ssl_fd
->
ssl_context
,
verify
,
NULL
);
/*
Set session_id - an identifier for this server session
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment