Skip to content

Commit 304e920

Browse files
committed
BUG#27357189: MASTER_USER BECOMES 'TEST' IF IT IS EMPTY WHEN READ FROM REPO
When the user for the master connection is empty and there is a read from the repository information the user becomes 'test'. This happens as the default value when there is no information is 'test'. The default value is now empty as well. ReviewBoard: 24194
1 parent 709006d commit 304e920

File tree

8 files changed

+95
-9
lines changed

8 files changed

+95
-9
lines changed

mysql-test/extra/rpl_tests/rpl_reset_slave.test

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,48 @@ if ($_show_master_host != No such row)
132132
--eval CHANGE MASTER TO MASTER_HOST= '$_slave_master_host', MASTER_USER= '$_slave_master_user', MASTER_PORT= $_slave_master_port
133133
--source include/start_slave.inc
134134

135+
#
136+
# Bug#27357189 MASTER_USER BECOMES 'TEST' IF IT IS EMPTY WHEN READ FROM REPO
137+
#
138+
139+
# Clean all the previous info
140+
141+
--source include/stop_slave.inc
142+
143+
--let $rpl_reset_slave_all= 1
144+
--source include/rpl_reset_slave.inc
145+
146+
--echo # Configure the slave with an empty user
147+
148+
--replace_result $MASTER_MYPORT MASTER_PORT
149+
--eval CHANGE MASTER TO MASTER_USER='', MASTER_PORT=$MASTER_MYPORT, MASTER_HOST='localhost'
150+
151+
--echo # Issue a RESET SLAVE instruction and try to start the slave IO thread that will error out
152+
153+
--let $rpl_reset_slave_all= 0
154+
--source include/rpl_reset_slave.inc
155+
156+
START SLAVE IO_THREAD;
157+
158+
--let $slave_io_errno= convert_error(ER_SLAVE_FATAL_ERROR)
159+
--source include/wait_for_slave_io_error.inc
160+
161+
--echo # Check the user is still empty
162+
163+
--let $_user= `SELECT user_name FROM mysql.slave_master_info`
164+
--let $assert_cond= "$_user" = ""
165+
--let $assert_text= User_name in slave_master_info is empty
166+
--source include/assert.inc
167+
168+
--echo # Cleanup
169+
170+
--let $rpl_reset_slave_all= 1
171+
--source include/rpl_reset_slave.inc
172+
173+
--replace_result $MASTER_MYPORT MASTER_PORT
174+
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root'
175+
--source include/start_slave.inc
176+
177+
call mtr.add_suppression("Slave I/O for channel '': Fatal error: Invalid .* username when attempting to connect to the master server*");
178+
135179
--source include/rpl_end.inc

mysql-test/suite/group_replication/r/gr_recovery_connection_options.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ include/start_group_replication.inc
6767
SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
6868
include/gr_wait_for_member_state.inc
6969
# Verify that the show slave status shows specific IO_error
70+
include/wait_for_slave_io_error.inc [errno=13117 FOR CHANNEL 'group_replication_recovery']
7071
include/stop_group_replication.inc
7172
#
7273
# Set MASTER_USER to non existing user, watching it fail

mysql-test/suite/group_replication/r/gr_start_gr_with_credentials_3.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ include/gr_start_applier_sql_thread.inc
7777
START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier";
7878
[connection server2]
7979
include/gr_wait_for_member_state.inc
80-
include/assert.inc [User name displayed is of supplied in command.]
80+
include/assert.inc [User name displayed is empty.]
8181
include/stop_group_replication.inc
8282
include/assert.inc [Password is not logged.]
8383
include/assert.inc [Password is logged as secret.]

mysql-test/suite/group_replication/t/gr_recovery_connection_options.test

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,9 @@ SET DEBUG_SYNC= "now SIGNAL signal.recovery_end";
145145
--source include/gr_wait_for_member_state.inc
146146

147147
--echo # Verify that the show slave status shows specific IO_error
148-
let $show_statement= SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery';
149-
let $field= Last_IO_Errno;
150-
let $condition= = '1045';
151-
--source include/wait_show_condition.inc
148+
--let $rpl_channel_name= 'group_replication_recovery'
149+
--let $slave_io_errno= convert_error(ER_SLAVE_FATAL_ERROR)
150+
--source include/wait_for_slave_io_error.inc
152151

153152
--source include/stop_group_replication.inc
154153

mysql-test/suite/group_replication/t/gr_start_gr_with_credentials_3.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ START GROUP_REPLICATION USER='regular_user_p' , PASSWORD='0123456789012345678901
146146
--let $group_replication_member_state = ONLINE
147147
--source include/gr_wait_for_member_state.inc
148148

149-
--let $assert_text= User name displayed is of supplied in command.
150-
--let $assert_cond= "[SELECT USER FROM performance_schema.replication_connection_configuration WHERE CHANNEL_NAME="group_replication_recovery"]" = "test"
149+
--let $assert_text= User name displayed is empty.
150+
--let $assert_cond= "[SELECT USER FROM performance_schema.replication_connection_configuration WHERE CHANNEL_NAME="group_replication_recovery"]" = ""
151151
--source include/assert.inc
152152

153153
--source include/stop_group_replication.inc

mysql-test/suite/rpl/r/rpl_mix_row_reset_slave.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,25 @@ Warnings:
8585
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
8686
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
8787
include/start_slave.inc
88+
include/stop_slave.inc
89+
include/rpl_reset_slave.inc
90+
# Configure the slave with an empty user
91+
CHANGE MASTER TO MASTER_USER='', MASTER_PORT=MASTER_PORT, MASTER_HOST='localhost';
92+
Warnings:
93+
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
94+
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
95+
# Issue a RESET SLAVE instruction and try to start the slave IO thread that will error out
96+
include/rpl_reset_slave.inc
97+
START SLAVE IO_THREAD;
98+
include/wait_for_slave_io_error.inc [errno=13117]
99+
# Check the user is still empty
100+
include/assert.inc [User_name in slave_master_info is empty]
101+
# Cleanup
102+
include/rpl_reset_slave.inc
103+
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
104+
Warnings:
105+
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
106+
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
107+
include/start_slave.inc
108+
call mtr.add_suppression("Slave I/O for channel '': Fatal error: Invalid .* username when attempting to connect to the master server*");
88109
include/rpl_end.inc

mysql-test/suite/rpl/r/rpl_stm_reset_slave.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,25 @@ Warnings:
8787
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
8888
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
8989
include/start_slave.inc
90+
include/stop_slave.inc
91+
include/rpl_reset_slave.inc
92+
# Configure the slave with an empty user
93+
CHANGE MASTER TO MASTER_USER='', MASTER_PORT=MASTER_PORT, MASTER_HOST='localhost';
94+
Warnings:
95+
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
96+
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
97+
# Issue a RESET SLAVE instruction and try to start the slave IO thread that will error out
98+
include/rpl_reset_slave.inc
99+
START SLAVE IO_THREAD;
100+
include/wait_for_slave_io_error.inc [errno=13117]
101+
# Check the user is still empty
102+
include/assert.inc [User_name in slave_master_info is empty]
103+
# Cleanup
104+
include/rpl_reset_slave.inc
105+
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
106+
Warnings:
107+
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
108+
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
109+
include/start_slave.inc
110+
call mtr.add_suppression("Slave I/O for channel '': Fatal error: Invalid .* username when attempting to connect to the master server*");
90111
include/rpl_end.inc

sql/rpl_mi.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -494,7 +494,7 @@ bool Master_info::read_info(Rpl_info_handler *from) {
494494

495495
if (!!from->get_info(&temp_master_log_pos, (ulong)BIN_LOG_HEADER_SIZE) ||
496496
!!from->get_info(host, sizeof(host), (char *)nullptr) ||
497-
!!from->get_info(user, sizeof(user), "test") ||
497+
!!from->get_info(user, sizeof(user), (char *)nullptr) ||
498498
!!from->get_info(password, sizeof(password), (char *)nullptr) ||
499499
!!from->get_info((int *)&port, (int)MYSQL_PORT) ||
500500
!!from->get_info((int *)&connect_retry, (int)DEFAULT_CONNECT_RETRY))

0 commit comments

Comments
 (0)