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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c30c6321
Commit
c30c6321
authored
Sep 02, 2005
by
dlenev@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/dlenev/src/mysql-5.0-merges
parents
4b677dfa
9dcae4c0
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
326 additions
and
157 deletions
+326
-157
mysql-test/r/grant2.result
mysql-test/r/grant2.result
+9
-0
mysql-test/t/grant2.test
mysql-test/t/grant2.test
+43
-0
sql/mysqld.cc
sql/mysqld.cc
+2
-2
sql/sql_acl.cc
sql/sql_acl.cc
+249
-149
sql/sql_acl.h
sql/sql_acl.h
+4
-4
sql/sql_parse.cc
sql/sql_parse.cc
+19
-2
No files found.
mysql-test/r/grant2.result
View file @
c30c6321
...
...
@@ -312,3 +312,12 @@ flush privileges;
drop database mysqltest_1;
set password = password("changed");
ERROR 42000: Access denied for user ''@'localhost' to database 'mysql'
lock table mysql.user write;
flush privileges;
grant all on *.* to 'mysqltest_1'@'localhost';
unlock tables;
lock table mysql.user write;
set password for 'mysqltest_1'@'localhost' = password('');
revoke all on *.* from 'mysqltest_1'@'localhost';
unlock tables;
drop user 'mysqltest_1'@'localhost';
mysql-test/t/grant2.test
View file @
c30c6321
...
...
@@ -351,4 +351,47 @@ set password = password("changed");
disconnect
n5
;
connection
default
;
# Bug #12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in
# multi-threaded environment". We should be able to execute FLUSH
# PRIVILEGES and SET PASSWORD simultaneously with other account
# management commands (such as GRANT and REVOKE) without causing
# deadlocks. To achieve this we should ensure that all account
# management commands take table and internal locks in the same order.
connect
(
con2root
,
localhost
,
root
,,);
connect
(
con3root
,
localhost
,
root
,,);
# Check that we can execute FLUSH PRIVILEGES and GRANT simultaneously
# This will check that locks are taken in proper order during both
# user/db-level and table/column-level privileges reloading.
connection
default
;
lock
table
mysql
.
user
write
;
connection
con2root
;
send
flush
privileges
;
connection
con3root
;
send
grant
all
on
*.*
to
'mysqltest_1'
@
'localhost'
;
connection
default
;
unlock
tables
;
connection
con2root
;
reap
;
connection
con3root
;
reap
;
# Check for simultaneous SET PASSWORD and REVOKE.
connection
default
;
lock
table
mysql
.
user
write
;
connection
con2root
;
send
set
password
for
'mysqltest_1'
@
'localhost'
=
password
(
''
);
connection
con3root
;
send
revoke
all
on
*.*
from
'mysqltest_1'
@
'localhost'
;
connection
default
;
unlock
tables
;
connection
con2root
;
reap
;
connection
con3root
;
reap
;
connection
default
;
# Clean-up
drop
user
'mysqltest_1'
@
'localhost'
;
disconnect
con2root
;
disconnect
con3root
;
# End of 4.1 tests
sql/mysqld.cc
View file @
c30c6321
...
...
@@ -3254,7 +3254,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
*/
error_handler_hook
=
my_message_sql
;
start_signal_handler
();
// Creates pidfile
if
(
acl_init
(
(
THD
*
)
0
,
opt_noacl
)
||
if
(
acl_init
(
opt_noacl
)
||
my_tz_init
((
THD
*
)
0
,
default_tz_name
,
opt_bootstrap
))
{
abort_loop
=
1
;
...
...
@@ -3271,7 +3271,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
exit
(
1
);
}
if
(
!
opt_noacl
)
(
void
)
grant_init
(
(
THD
*
)
0
);
(
void
)
grant_init
();
#ifdef HAVE_DLOPEN
if
(
!
opt_noacl
)
...
...
sql/sql_acl.cc
View file @
c30c6321
This diff is collapsed.
Click to expand it.
sql/sql_acl.h
View file @
c30c6321
...
...
@@ -174,8 +174,8 @@ public:
/* prototypes */
bool
hostname_requires_resolving
(
const
char
*
hostname
);
my_bool
acl_init
(
THD
*
thd
,
bool
dont_read_acl_tables
);
void
acl_reload
(
THD
*
thd
);
my_bool
acl_init
(
bool
dont_read_acl_tables
);
my_bool
acl_reload
(
THD
*
thd
);
void
acl_free
(
bool
end
=
0
);
ulong
acl_get
(
const
char
*
host
,
const
char
*
ip
,
const
char
*
user
,
const
char
*
db
,
my_bool
db_is_pattern
);
...
...
@@ -196,9 +196,9 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table, bool is_proc,
List
<
LEX_USER
>
&
user_list
,
ulong
rights
,
bool
revoke
,
bool
no_error
);
ACL_USER
*
check_acl_user
(
LEX_USER
*
user_name
,
uint
*
acl_acl_userdx
);
my_bool
grant_init
(
THD
*
thd
);
my_bool
grant_init
();
void
grant_free
(
void
);
void
grant_reload
(
THD
*
thd
);
my_bool
grant_reload
(
THD
*
thd
);
bool
check_grant
(
THD
*
thd
,
ulong
want_access
,
TABLE_LIST
*
tables
,
uint
show_command
,
uint
number
,
bool
dont_print_error
);
bool
check_grant_column
(
THD
*
thd
,
GRANT_INFO
*
grant
,
...
...
sql/sql_parse.cc
View file @
c30c6321
...
...
@@ -6552,8 +6552,25 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if
(
options
&
REFRESH_GRANT
)
{
acl_reload
(
thd
);
grant_reload
(
thd
);
THD
*
tmp_thd
=
0
;
/*
If reload_acl_and_cache() is called from SIGHUP handler we have to
allocate temporary THD for execution of acl_reload()/grant_reload().
*/
if
(
!
thd
&&
(
thd
=
(
tmp_thd
=
new
THD
)))
thd
->
store_globals
();
if
(
thd
)
{
(
void
)
acl_reload
(
thd
);
(
void
)
grant_reload
(
thd
);
}
if
(
tmp_thd
)
{
delete
tmp_thd
;
/* Remember that we don't have a THD */
my_pthread_setspecific_ptr
(
THR_THD
,
0
);
thd
=
0
;
}
reset_mqh
((
LEX_USER
*
)
NULL
,
TRUE
);
}
#endif
...
...
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