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

MariaDB Server detection fix

Use mariadb_connection() instead of checking 5.5.5 rpl hack
to detect if we are connected to a MariaDB Server.
This commit is contained in:
Georg Richter
2023-04-21 07:11:29 +02:00
parent 11ba413498
commit 0e452f66ac

View File

@@ -1356,7 +1356,6 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
MA_PVIO_CINFO cinfo= {NULL, NULL, 0, -1, NULL};
MARIADB_PVIO *pvio= NULL;
char *scramble_data;
my_bool is_maria= 0;
const char *scramble_plugin;
uint pkt_length, scramble_len, pkt_scramble_len= 0;
NET *net= &mysql->net;
@@ -1566,7 +1565,6 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
if (strncmp(end, MA_RPL_VERSION_HACK, sizeof(MA_RPL_VERSION_HACK) - 1) == 0)
{
mysql->server_version= strdup(end + sizeof(MA_RPL_VERSION_HACK) - 1);
is_maria= 1;
}
else
{
@@ -1575,7 +1573,6 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
goto error;
}
is_maria= mariadb_connection(mysql);
}
end+= strlen(end) + 1;
@@ -1606,7 +1603,7 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
pkt_scramble_len= uint1korr(end + 7);
/* check if MariaD2B specific capabilities are available */
if (is_maria && !(mysql->server_capabilities & CLIENT_MYSQL))
if (mariadb_connection(mysql) && !(mysql->server_capabilities & CLIENT_MYSQL))
{
mysql->extension->mariadb_server_capabilities= (ulonglong) uint4korr(end + 14);
}