mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES
Problem: ``SET PASSWORD FOR foo@localhost'' was written into binary log using double quites: ``SET PASSWORD FOR "foo"@"localhost"...''. If sql_mode was set to ANSI_QUOTES, parser on slave considered "foo" and "localhost" as identifiers instead of strigns constants, so it failed to parse, generated syntax error and slave then stopped. Fix: changing binary log entries to use single quotes: ``SET PASSWORD FOR 'foo'@'localhost'...'' not to depend on ANSI_QUOTES. mysql-test/r/rpl_do_grant.result: Adding test case mysql-test/t/rpl_do_grant.test: Adding test case sql/sql_acl.cc: Using single quotes instead of double quotes, not to fails when sql_mode=ANSI_QUOTES.
This commit is contained in:
@ -20,6 +20,17 @@ set password for rpl_do_grant@localhost=password("does it work?");
|
|||||||
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
|
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
|
||||||
password<>_binary''
|
password<>_binary''
|
||||||
1
|
1
|
||||||
|
update mysql.user set password='' where user='rpl_do_grant';
|
||||||
|
flush privileges;
|
||||||
|
select password<>'' from mysql.user where user='rpl_do_grant';
|
||||||
|
password<>''
|
||||||
|
0
|
||||||
|
set sql_mode='ANSI_QUOTES';
|
||||||
|
set password for rpl_do_grant@localhost=password('does it work?');
|
||||||
|
set sql_mode='';
|
||||||
|
select password<>'' from mysql.user where user='rpl_do_grant';
|
||||||
|
password<>''
|
||||||
|
1
|
||||||
delete from mysql.user where user=_binary'rpl_do_grant';
|
delete from mysql.user where user=_binary'rpl_do_grant';
|
||||||
delete from mysql.db where user=_binary'rpl_do_grant';
|
delete from mysql.db where user=_binary'rpl_do_grant';
|
||||||
flush privileges;
|
flush privileges;
|
||||||
|
@ -33,6 +33,22 @@ connection slave;
|
|||||||
sync_with_master;
|
sync_with_master;
|
||||||
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
|
select password<>_binary'' from mysql.user where user=_binary'rpl_do_grant';
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#24158 SET PASSWORD in binary log fails under ANSI_QUOTES
|
||||||
|
#
|
||||||
|
connection master;
|
||||||
|
update mysql.user set password='' where user='rpl_do_grant';
|
||||||
|
flush privileges;
|
||||||
|
select password<>'' from mysql.user where user='rpl_do_grant';
|
||||||
|
set sql_mode='ANSI_QUOTES';
|
||||||
|
set password for rpl_do_grant@localhost=password('does it work?');
|
||||||
|
set sql_mode='';
|
||||||
|
save_master_pos;
|
||||||
|
connection slave;
|
||||||
|
sync_with_master;
|
||||||
|
select password<>'' from mysql.user where user='rpl_do_grant';
|
||||||
|
|
||||||
|
|
||||||
# clear what we have done, to not influence other tests.
|
# clear what we have done, to not influence other tests.
|
||||||
connection master;
|
connection master;
|
||||||
delete from mysql.user where user=_binary'rpl_do_grant';
|
delete from mysql.user where user=_binary'rpl_do_grant';
|
||||||
|
@ -1498,7 +1498,7 @@ bool change_password(THD *thd, const char *host, const char *user,
|
|||||||
{
|
{
|
||||||
query_length=
|
query_length=
|
||||||
my_sprintf(buff,
|
my_sprintf(buff,
|
||||||
(buff,"SET PASSWORD FOR \"%-.120s\"@\"%-.120s\"=\"%-.120s\"",
|
(buff,"SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
|
||||||
acl_user->user ? acl_user->user : "",
|
acl_user->user ? acl_user->user : "",
|
||||||
acl_user->host.hostname ? acl_user->host.hostname : "",
|
acl_user->host.hostname ? acl_user->host.hostname : "",
|
||||||
new_password));
|
new_password));
|
||||||
|
Reference in New Issue
Block a user