Commit 8f05c848 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

MDEV-10541: Faking the version string only works with MariaDB-Clients

Our RPL_VERSION_HACK prefix caused MySQL clients to always report 5.5
major and minor versions, even if a specific fake version is passed via
my.cnf or command line parameters. When a specific version is requested,
don't employ the RPL_VERSION_HACK prefix within the server handshake
packet.
parent c22ef4df
......@@ -630,6 +630,7 @@ Time_zone *default_tz;
const char *mysql_real_data_home_ptr= mysql_real_data_home;
char server_version[SERVER_VERSION_LENGTH], *server_version_ptr;
bool using_custom_server_version= false;
char *mysqld_unix_port, *opt_mysql_tmpdir;
ulong thread_handling;
......@@ -8960,6 +8961,7 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
{
strmake(server_version, argument, sizeof(server_version) - 1);
set_sys_var_value_origin(&server_version_ptr, sys_var::CONFIG);
using_custom_server_version= true;
}
#ifndef EMBEDDED_LIBRARY
else
......
......@@ -544,6 +544,7 @@ extern const char *mysql_real_data_home_ptr;
extern ulong thread_handling;
extern "C" MYSQL_PLUGIN_IMPORT char server_version[SERVER_VERSION_LENGTH];
extern char *server_version_ptr;
extern bool using_custom_server_version;
extern MYSQL_PLUGIN_IMPORT char mysql_real_data_home[];
extern char mysql_unpacked_real_data_home[];
extern MYSQL_PLUGIN_IMPORT struct system_variables global_system_variables;
......
......@@ -12062,7 +12062,13 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio,
data_len= SCRAMBLE_LENGTH;
}
/* When server version is specified in config file, don't include
the replication hack prefix. */
if (using_custom_server_version)
end= strnmov(end, server_version, SERVER_VERSION_LENGTH) + 1;
else
end= strxnmov(end, SERVER_VERSION_LENGTH, RPL_VERSION_HACK, server_version, NullS) + 1;
int4store((uchar*) end, mpvio->auth_info.thd->thread_id);
end+= 4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment