From 6a8ba999bddcbe6d5a4d7e9c357be573e480e85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 8 Nov 2018 08:31:48 +0200 Subject: [PATCH] MXS-2095: Fix crash on GRANT CREATE TEMPORARY TABLE The avrorouter classified the GRANT statement as a CREATE TABLE statement. --- maxscale-system-test/avro.cpp | 5 +++++ server/modules/routing/avrorouter/avro.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/maxscale-system-test/avro.cpp b/maxscale-system-test/avro.cpp index 384ebe3d4..be8f85ecf 100644 --- a/maxscale-system-test/avro.cpp +++ b/maxscale-system-test/avro.cpp @@ -37,6 +37,11 @@ int main(int argc, char *argv[]) test.set_timeout(120); test.repl->connect(); + // MXS-2095: Crash on GRANT CREATE TABLE + execute_query(test.repl->nodes[0], "CREATE USER test IDENTIFIED BY 'test'"); + execute_query(test.repl->nodes[0], "GRANT CREATE TEMPORARY TABLES ON *.* TO test"); + execute_query(test.repl->nodes[0], "DROP USER test"); + create_t1(test.repl->nodes[0]); insert_into_t1(test.repl->nodes[0], 3); execute_query(test.repl->nodes[0], "FLUSH LOGS"); diff --git a/server/modules/routing/avrorouter/avro.c b/server/modules/routing/avrorouter/avro.c index bf9c44ddf..32034c6af 100644 --- a/server/modules/routing/avrorouter/avro.c +++ b/server/modules/routing/avrorouter/avro.c @@ -59,9 +59,9 @@ static const char* avro_index_name = "avro.index"; /** For detection of CREATE/ALTER TABLE statements */ static const char* create_table_regex = - "(?i)create[a-z0-9[:space:]_]+table"; + "(?i)^[[:space:]]*create[a-z0-9[:space:]_]+table"; static const char* alter_table_regex = - "(?i)alter[[:space:]]+table"; + "(?i)^[[:space:]]*alter[[:space:]]+table"; /* The router entry points */ static MXS_ROUTER *createInstance(SERVICE *service, char **options);