diff options
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index ff371b270b7..98b75bc6dad 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1137,7 +1137,7 @@ int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f) memcpy(buf_act, buf, read_size); snd_size= my_b_gets(f, buf_act + read_size, max_size - read_size); if (snd_size == 0 || - ((snd_size + 1 == max_size - read_size) && buf[max_size - 2] != '\n')) + ((snd_size + 1 == max_size - read_size) && buf_act[max_size - 2] != '\n')) { /* failure to make the 2nd read or short read again @@ -4547,6 +4547,16 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, if (opt_plugin_dir_ptr && *opt_plugin_dir_ptr)
mysql_options(mysql, MYSQL_PLUGIN_DIR, opt_plugin_dir_ptr);
+ /* we disallow empty users */ + if (mi->user == NULL || mi->user[0] == 0) + { + mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, + ER(ER_SLAVE_FATAL_ERROR), + "Invalid (empty) username when attempting to " + "connect to the master server. Connection attempt " + "terminated."); + DBUG_RETURN(1); + } while (!(slave_was_killed = io_slave_killed(thd,mi)) && (reconnect ? mysql_reconnect(mysql) != 0 : mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, @@ -4676,7 +4686,9 @@ MYSQL *rpl_connect_master(MYSQL *mysql) /* This one is not strictly needed but we have it here for completeness */ mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir); - if (io_slave_killed(thd, mi) + if (mi->user == NULL + || mi->user[0] == 0 + || io_slave_killed(thd, mi) || !mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, mi->port, 0, 0)) { |