compatible with mysql5.1 authentication

This commit is contained in:
jingxiaobing 2018-05-17 14:24:42 +08:00
parent 03be84bcdc
commit 913b6a8987
3 changed files with 8 additions and 3 deletions

View File

@ -200,7 +200,9 @@ NETWORK_MYSQLD_PLUGIN_PROTO(server_read_auth)
#endif
con->client->response = auth;
if (g_strcmp0(auth->auth_plugin_name->str, "mysql_native_password") != 0) {
if ((auth->client_capabilities & CLIENT_PLUGIN_AUTH)
&& (g_strcmp0(auth->auth_plugin_name->str, "mysql_native_password") != 0))
{
GString *packet = g_string_new(0);
network_mysqld_proto_append_auth_switch(packet, "mysql_native_password",
con->client->challenge->auth_plugin_data);

View File

@ -99,7 +99,8 @@ typedef struct {
#define COMPATIBLE_BASIC_FLAGS (CLIENT_BASIC_FLAGS \
|CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA \
|CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS \
|CLIENT_SESSION_TRACK)
|CLIENT_SESSION_TRACK \
|CLIENT_PLUGIN_AUTH)
#else
#define COMPATIBLE_BASIC_FLAGS CLIENT_BASIC_FLAGS
#endif

View File

@ -159,7 +159,9 @@ do_read_auth(network_mysqld_con *con, GHashTable *allow_ip_table, GHashTable *de
con->client->response = auth;
if (g_strcmp0(auth->auth_plugin_name->str, "mysql_native_password") != 0) {
if ((auth->client_capabilities & CLIENT_PLUGIN_AUTH)
&& (g_strcmp0(auth->auth_plugin_name->str, "mysql_native_password") != 0))
{
GString *packet = g_string_new(0);
network_mysqld_proto_append_auth_switch(packet, "mysql_native_password",
con->client->challenge->auth_plugin_data);