diff options
author | Luis Soares <luis.soares@oracle.com> | 2011-11-24 14:51:18 +0000 |
---|---|---|
committer | Luis Soares <luis.soares@oracle.com> | 2011-11-24 14:51:18 +0000 |
commit | 4b157e1556b5c7d5da11b6eb0e4ba72378ce9cfd (patch) | |
tree | 4597c571d43b70b54d380b192312ba7d418ef024 /sql | |
parent | 5d81384c5a8ed557be2f14eea771475e43edaa90 (diff) | |
download | mariadb-git-4b157e1556b5c7d5da11b6eb0e4ba72378ce9cfd.tar.gz |
BUG#13427949: CHANGE MASTER TO USER='' (EMPTY USER) CAUSES ERRORS ON VALGRING
When passing an empty user to the connect function will cause
valgrind warnings. Seems that the client code is not prepared
to handle empty users. On 5.6 this can even be triggered by
START SLAVE PASSWORD='...'; i.e., without setting USER='...' on
the START SLAVE command (see WL#4143 for details on the new
additional START SLAVE commands).
To fix this, we disallow empty users when configuring the slave
connection parameters (this decision might be revisited if the
client code accepts empty users in the future).
sql/slave.cc:
We throw an error if an empty user is supplied to the connection
function.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/slave.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 7a3eee952c3..5c931a79695 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -4208,6 +4208,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, @@ -4336,7 +4346,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)) { |