From f577d098292b63e616e3864216daebcdeab0c5e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 17 Nov 2020 10:43:40 +0200 Subject: [PATCH] MXS-3297: Don't advertise unsupported capabilities Only bulk execute is supported. Supporting progress reporting currently breaks the protocol result processing code. --- include/maxscale/protocol/mysql.h | 3 +++ server/modules/protocol/MySQL/mariadbclient/mysql_client.cc | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/maxscale/protocol/mysql.h b/include/maxscale/protocol/mysql.h index b5baedf00..454280b73 100644 --- a/include/maxscale/protocol/mysql.h +++ b/include/maxscale/protocol/mysql.h @@ -272,6 +272,9 @@ typedef enum #define MXS_MARIA_CAP_COM_MULTI (1 << 1) #define MXS_MARIA_CAP_STMT_BULK_OPERATIONS (1 << 2) +// Only bulk operations are supported +#define MXS_MARIADB_CAP_SERVER MXS_MARIA_CAP_STMT_BULK_OPERATIONS + typedef enum { MXS_COM_SLEEP = 0, diff --git a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc index f8c3b51a5..763f1de2f 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -661,7 +661,8 @@ static void store_client_information(DCB* dcb, GWBUF* buffer) * there are extra capabilities stored in the last 4 bytes of the 23 byte filler. */ if ((proto->client_capabilities & GW_MYSQL_CAPABILITIES_CLIENT_MYSQL) == 0) { - proto->extra_capabilities = gw_mysql_get_byte4(data + MARIADB_CAP_OFFSET); + uint32_t caps = gw_mysql_get_byte4(data + MARIADB_CAP_OFFSET); + proto->extra_capabilities = caps & MXS_MARIADB_CAP_SERVER; } if (len > MYSQL_AUTH_PACKET_BASE_SIZE)