1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Fix for MDEV-18721 (Host option in configuration file is ignored.)

We need to check the passed host variable after the configuration file was read.
Thanks to Peter Penchev and Corey Hickey for providing patches.
This commit is contained in:
Georg Richter
2019-02-24 20:00:02 +01:00
parent 0acf529e34
commit 31ae1278aa

View File

@@ -1215,11 +1215,6 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
if (!mysql->methods)
mysql->methods= &MARIADB_DEFAULT_METHODS;
if (!host || !host[0])
host = mysql->options.host;
ma_set_connect_attrs(mysql, host);
if (net->pvio) /* check if we are already connected */
{
SET_CLIENT_ERROR(mysql, CR_ALREADY_CONNECTED, SQLSTATE_UNKNOWN, 0);
@@ -1238,6 +1233,11 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
}
if (!host || !host[0])
host = mysql->options.host;
ma_set_connect_attrs(mysql, host);
#ifndef WIN32
if (mysql->options.protocol > MYSQL_PROTOCOL_SOCKET)
{