Commit b5c258a8 authored by Luis Soares's avatar Luis Soares

automerge: merged bug clone into latest mysql-5.1-bugteam.

parents 5b54e86e fdfb74b3
...@@ -242,4 +242,18 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION ...@@ -242,4 +242,18 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
DROP TABLE t1; DROP TABLE t1;
DROP PROCEDURE p1; DROP PROCEDURE p1;
DROP USER 'user49119'@'localhost'; DROP USER 'user49119'@'localhost';
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;
grant all on *.* to foo@"1.2.3.4";
revoke all privileges, grant option from "foo";
ERROR HY000: Can't revoke all privileges for one or more of the requested users
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; grant all on *.* to foo@"1.2.3.4"
master-bin.000001 # Query # # use `test`; revoke all privileges, grant option from "foo"
DROP USER foo@"1.2.3.4";
"End of test" "End of test"
...@@ -316,4 +316,33 @@ DROP USER 'user49119'@'localhost'; ...@@ -316,4 +316,33 @@ DROP USER 'user49119'@'localhost';
-- sync_slave_with_master -- sync_slave_with_master
#
# Bug #51987 revoke privileges logs wrong error code
#
-- connection master
-- source include/master-slave-reset.inc
-- connection master
grant all on *.* to foo@"1.2.3.4";
-- error ER_REVOKE_GRANTS
revoke all privileges, grant option from "foo";
## assertion: revoke is logged
-- source include/show_binlog_events.inc
-- sync_slave_with_master
## assertion: slave replicates revoke and does not fail because master
## logged revoke with correct expected error code
-- let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1)
if ($err)
{
-- die UNEXPECTED ERROR AT SLAVE: $err
}
-- connection master
DROP USER foo@"1.2.3.4";
-- sync_slave_with_master
--echo "End of test" --echo "End of test"
...@@ -6117,19 +6117,19 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list) ...@@ -6117,19 +6117,19 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
int binlog_error= if (result)
my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
result= result |
write_bin_log(thd, FALSE, thd->query(), thd->query_length()); write_bin_log(thd, FALSE, thd->query(), thd->query_length());
rw_unlock(&LOCK_grant); rw_unlock(&LOCK_grant);
close_thread_tables(thd); close_thread_tables(thd);
/* error for writing binary log has already been reported */
if (result && !binlog_error)
my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
/* Restore the state of binlog format */ /* Restore the state of binlog format */
thd->current_stmt_binlog_row_based= save_binlog_row_based; thd->current_stmt_binlog_row_based= save_binlog_row_based;
DBUG_RETURN(result || binlog_error); DBUG_RETURN(result);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment