diff --git a/src/protocol/MySQLMessage.cc b/src/protocol/MySQLMessage.cc index c3c83dcd..1dac9085 100644 --- a/src/protocol/MySQLMessage.cc +++ b/src/protocol/MySQLMessage.cc @@ -190,6 +190,7 @@ std::string MySQLRequest::get_query() const #define MYSQL_CAPFLAG_CLIENT_PS_MULTI_RESULTS 0x00040000 #define MYSQL_CAPFLAG_CLIENT_PLUGIN_AUTH 0x00080000 #define MYSQL_CAPFLAG_CLIENT_LOCAL_FILES 0x00000080 +#define MYSQL_CAPFLAG_CLIENT_SESSION_TRACK (1 << 23) int MySQLHandshakeResponse::encode(struct iovec vectors[], int max) { @@ -336,7 +337,8 @@ int MySQLSSLRequest::encode(struct iovec vectors[], int max) MYSQL_CAPFLAG_CLIENT_LOCAL_FILES | MYSQL_CAPFLAG_CLIENT_MULTI_STATEMENTS | MYSQL_CAPFLAG_CLIENT_PS_MULTI_RESULTS | - MYSQL_CAPFLAG_CLIENT_PLUGIN_AUTH); + MYSQL_CAPFLAG_CLIENT_PLUGIN_AUTH | + MYSQL_CAPFLAG_CLIENT_SESSION_TRACK); pos += 4; int4store(pos, 0); pos += 4; @@ -374,7 +376,8 @@ int MySQLAuthRequest::encode(struct iovec vectors[], int max) MYSQL_CAPFLAG_CLIENT_LOCAL_FILES | MYSQL_CAPFLAG_CLIENT_MULTI_STATEMENTS | MYSQL_CAPFLAG_CLIENT_PS_MULTI_RESULTS | - MYSQL_CAPFLAG_CLIENT_PLUGIN_AUTH); + MYSQL_CAPFLAG_CLIENT_PLUGIN_AUTH | + MYSQL_CAPFLAG_CLIENT_SESSION_TRACK); pos += 4; int4store(pos, 0); pos += 4; diff --git a/src/protocol/mysql_parser.c b/src/protocol/mysql_parser.c index 36d07a66..3f1c1fb3 100644 --- a/src/protocol/mysql_parser.c +++ b/src/protocol/mysql_parser.c @@ -204,11 +204,17 @@ static int parse_ok_packet(const void *buf, size_t len, mysql_parser_t *parser) if (server_status & MYSQL_SERVER_SESSION_STATE_CHANGED) { + const unsigned char *tmp_str; + unsigned long long tmp_len; + if (decode_string(&str, &info_len, &p, buf_end) == 0) return -2; + + if (decode_string(&tmp_str, &tmp_len, &p, buf_end) == 0) + return -2; } else { - info_len = 0; str = p; + info_len = 0; } result_set = (struct __mysql_result_set *)malloc(sizeof(struct __mysql_result_set));