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
2abecf2a
Commit
2abecf2a
authored
Dec 06, 2009
by
Luis Soares
Browse files
Options
Browse Files
Download
Plain Diff
automerge: mysql-5.1-bugteam bug branch --> mysql-5.1-bugteam latest
parents
d5391ed6
289c1493
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
174 additions
and
1 deletion
+174
-1
mysql-test/suite/rpl/r/rpl_do_grant.result
mysql-test/suite/rpl/r/rpl_do_grant.result
+73
-0
mysql-test/suite/rpl/t/rpl_do_grant.test
mysql-test/suite/rpl/t/rpl_do_grant.test
+100
-0
sql/sql_acl.cc
sql/sql_acl.cc
+1
-1
No files found.
mysql-test/suite/rpl/r/rpl_do_grant.result
View file @
2abecf2a
...
...
@@ -169,4 +169,77 @@ DROP USER 'create_rout_db'@'localhost';
call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
USE mtr;
call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396");
######## BUG#49119 #######
### i) test case from the 'how to repeat section'
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1(c1 INT);
CREATE PROCEDURE p1() SELECT * FROM t1 |
REVOKE EXECUTE ON PROCEDURE p1 FROM 'root'@'localhost';
ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' on routine 'p1'
DROP TABLE t1;
DROP PROCEDURE p1;
### ii) Test case in which REVOKE partially succeeds
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1(c1 INT);
CREATE PROCEDURE p1() SELECT * FROM t1 |
CREATE USER 'user49119'@'localhost';
GRANT EXECUTE ON PROCEDURE p1 TO 'user49119'@'localhost';
##############################################################
### Showing grants for both users: root and user49119 (master)
SHOW GRANTS FOR 'user49119'@'localhost';
Grants for user49119@localhost
GRANT USAGE ON *.* TO 'user49119'@'localhost'
GRANT EXECUTE ON PROCEDURE `test`.`p1` TO 'user49119'@'localhost'
SHOW GRANTS FOR CURRENT_USER;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
##############################################################
##############################################################
### Showing grants for both users: root and user49119 (master)
SHOW GRANTS FOR 'user49119'@'localhost';
Grants for user49119@localhost
GRANT USAGE ON *.* TO 'user49119'@'localhost'
GRANT EXECUTE ON PROCEDURE `test`.`p1` TO 'user49119'@'localhost'
SHOW GRANTS FOR CURRENT_USER;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
##############################################################
## This statement will make the revoke fail because root has no
## execute grant. However, it will still revoke the grant for
## user49119.
REVOKE EXECUTE ON PROCEDURE p1 FROM 'user49119'@'localhost', 'root'@'localhost';
ERROR 42000: There is no such grant defined for user 'root' on host 'localhost' on routine 'p1'
##############################################################
### Showing grants for both users: root and user49119 (master)
### after revoke statement failure
SHOW GRANTS FOR 'user49119'@'localhost';
Grants for user49119@localhost
GRANT USAGE ON *.* TO 'user49119'@'localhost'
SHOW GRANTS FOR CURRENT_USER;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
##############################################################
#############################################################
### Showing grants for both users: root and user49119 (slave)
### after revoke statement failure (should match
SHOW GRANTS FOR 'user49119'@'localhost';
Grants for user49119@localhost
GRANT USAGE ON *.* TO 'user49119'@'localhost'
SHOW GRANTS FOR CURRENT_USER;
Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
##############################################################
DROP TABLE t1;
DROP PROCEDURE p1;
DROP USER 'user49119'@'localhost';
"End of test"
mysql-test/suite/rpl/t/rpl_do_grant.test
View file @
2abecf2a
...
...
@@ -216,4 +216,104 @@ connection slave;
USE
mtr
;
call
mtr
.
add_suppression
(
"Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"
);
# BUG#49119: Master crashes when executing 'REVOKE ... ON
# {PROCEDURE|FUNCTION} FROM ...'
#
# The tests are divided into two test cases:
#
# i) a test case that mimics the one in the bug report.
#
# - We show that, despite the fact, that a revoke command fails
# when binlogging is active, the master will not hit an
# assertion.
#
# ii) a test case that partially succeeds on the master will also
# partially succeed on the slave.
#
# - The revoke statement that partially succeeds tries to revoke
# an EXECUTE grant for two users, and only one of the user has
# the specific grant. This will cause mysql to drop one of the
# grants and report error for the statement. The slave should
# also drop the grants that the master succeed and the SQL
# thread should not stop on statement failure.
--
echo
######## BUG#49119 #######
--
echo
### i) test case from the 'how to repeat section'
--
source
include
/
master
-
slave
-
reset
.
inc
--
connection
master
CREATE
TABLE
t1
(
c1
INT
);
DELIMITER
|
;
CREATE
PROCEDURE
p1
()
SELECT
*
FROM
t1
|
DELIMITER
;
|
--
error
ER_NONEXISTING_PROC_GRANT
REVOKE
EXECUTE
ON
PROCEDURE
p1
FROM
'root'
@
'localhost'
;
--
sync_slave_with_master
--
connection
master
DROP
TABLE
t1
;
DROP
PROCEDURE
p1
;
--
sync_slave_with_master
--
echo
### ii) Test case in which REVOKE partially succeeds
--
connection
master
--
source
include
/
master
-
slave
-
reset
.
inc
--
connection
master
CREATE
TABLE
t1
(
c1
INT
);
DELIMITER
|
;
CREATE
PROCEDURE
p1
()
SELECT
*
FROM
t1
|
DELIMITER
;
|
CREATE
USER
'user49119'
@
'localhost'
;
GRANT
EXECUTE
ON
PROCEDURE
p1
TO
'user49119'
@
'localhost'
;
--
echo
##############################################################
--
echo
### Showing grants for both users: root and user49119 (master)
SHOW
GRANTS
FOR
'user49119'
@
'localhost'
;
SHOW
GRANTS
FOR
CURRENT_USER
;
--
echo
##############################################################
--
sync_slave_with_master
--
echo
##############################################################
--
echo
### Showing grants for both users: root and user49119 (master)
SHOW
GRANTS
FOR
'user49119'
@
'localhost'
;
SHOW
GRANTS
FOR
CURRENT_USER
;
--
echo
##############################################################
--
connection
master
--
echo
## This statement will make the revoke fail because root has no
--
echo
## execute grant. However, it will still revoke the grant for
--
echo
## user49119.
--
error
ER_NONEXISTING_PROC_GRANT
REVOKE
EXECUTE
ON
PROCEDURE
p1
FROM
'user49119'
@
'localhost'
,
'root'
@
'localhost'
;
--
echo
##############################################################
--
echo
### Showing grants for both users: root and user49119 (master)
--
echo
### after revoke statement failure
SHOW
GRANTS
FOR
'user49119'
@
'localhost'
;
SHOW
GRANTS
FOR
CURRENT_USER
;
--
echo
##############################################################
--
sync_slave_with_master
--
echo
#############################################################
--
echo
### Showing grants for both users: root and user49119 (slave)
--
echo
### after revoke statement failure (should match
SHOW
GRANTS
FOR
'user49119'
@
'localhost'
;
SHOW
GRANTS
FOR
CURRENT_USER
;
--
echo
##############################################################
--
connection
master
DROP
TABLE
t1
;
DROP
PROCEDURE
p1
;
DROP
USER
'user49119'
@
'localhost'
;
--
sync_slave_with_master
--
echo
"End of test"
sql/sql_acl.cc
View file @
2abecf2a
...
...
@@ -3378,7 +3378,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
if
(
write_to_binlog
)
{
write_bin_log
(
thd
,
TRU
E
,
thd
->
query
(),
thd
->
query_length
());
write_bin_log
(
thd
,
FALS
E
,
thd
->
query
(),
thd
->
query_length
());
}
rw_unlock
(
&
LOCK_grant
);
...
...
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