From a3e9ce651f4d578b0d365c53345e7929439ffa09 Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Wed, 15 May 2019 11:19:31 +0300 Subject: [PATCH 1/3] Add 'maxscale --version-full' command to call_mdbci() Previously Maxscale version check was in the 'check_backend', but this was removed from the tests execution process. Now 'maxscale --version-full' is added to nodes creation function - to call_mdbci() --- maxscale-system-test/testconnections.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index a482918bf..8530274ed 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -2122,6 +2122,16 @@ int TestConnections::call_mdbci(const char * options) { maxscales->read_basic_env(); } + int ec; + char * ver = maxscales->ssh_node_output(0, "maxscale --version-full", false, &ec); + if (ec) + { + tprintf("Error retrival of Maxscale version info"); + } + else + { + tprintf("Maxscale_full_version_start:\n%s\nMaxscale_full_version_end\n", ver); + } return 0; } From 2cd4da32a73df15b2cb5f6480d49982e4c884247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 16 May 2019 10:41:04 +0300 Subject: [PATCH 2/3] MXS-2494: Fix user loading queries for MariaDB 10.1+ The queries now properly check for the plugin. --- server/modules/authenticator/MySQLAuth/dbusers.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/modules/authenticator/MySQLAuth/dbusers.c b/server/modules/authenticator/MySQLAuth/dbusers.c index baa4893e8..8d614a049 100644 --- a/server/modules/authenticator/MySQLAuth/dbusers.c +++ b/server/modules/authenticator/MySQLAuth/dbusers.c @@ -61,12 +61,14 @@ const char* mariadb_102_users_query = " u.is_role, u.default_role" " FROM mysql.user AS u LEFT JOIN mysql.db AS d " " ON (u.user = d.user AND u.host = d.host) " + " WHERE u.plugin IN ('', 'mysql_native_password') " " UNION " " SELECT u.user, u.host, t.db, u.select_priv, " " IF(u.password <> '', u.password, u.authentication_string), " " u.is_role, u.default_role " " FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t " " ON (u.user = t.user AND u.host = t.host)" + " WHERE u.plugin IN ('', 'mysql_native_password') " "), users AS (" // Select the root row, the actual user " SELECT t.user, t.host, t.db, t.select_priv, t.password, t.default_role AS role FROM t" @@ -89,10 +91,12 @@ const char* mariadb_users_query = " SELECT u.user, u.host, d.db, u.select_priv, u.password AS password, u.is_role " " FROM mysql.user AS u LEFT JOIN mysql.db AS d " " ON (u.user = d.user AND u.host = d.host) " + " WHERE u.plugin IN ('', 'mysql_native_password') " " UNION " " SELECT u.user, u.host, t.db, u.select_priv, u.password AS password, u.is_role " " FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t " " ON (u.user = t.user AND u.host = t.host) " + " WHERE u.plugin IN ('', 'mysql_native_password') " ") AS t " // Discard any users that are roles "WHERE t.is_role <> 'Y' %s " @@ -103,10 +107,12 @@ const char* mariadb_users_query = " SELECT u.user, u.host, d.db, u.select_priv, u.password AS password, u.default_role " " FROM mysql.user AS u LEFT JOIN mysql.db AS d " " ON (u.user = d.user AND u.host = d.host) " + " WHERE u.plugin IN ('', 'mysql_native_password') " " UNION " " SELECT u.user, u.host, t.db, u.select_priv, u.password AS password, u.default_role " " FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t " " ON (u.user = t.user AND u.host = t.host) " + " WHERE u.plugin IN ('', 'mysql_native_password') " ") AS t " // Join it to the roles_mapping table to only have users with roles "JOIN mysql.roles_mapping AS r " @@ -117,10 +123,12 @@ const char* mariadb_users_query = " SELECT u.user, u.host, d.db, u.select_priv, u.password AS password, u.is_role " " FROM mysql.user AS u LEFT JOIN mysql.db AS d " " ON (u.user = d.user AND u.host = d.host) " + " WHERE u.plugin IN ('', 'mysql_native_password') " " UNION " " SELECT u.user, u.host, t.db, u.select_priv, u.password AS password, u.is_role " " FROM mysql.user AS u LEFT JOIN mysql.tables_priv AS t " " ON (u.user = t.user AND u.host = t.host) " + " WHERE u.plugin IN ('', 'mysql_native_password') " ") AS u " "ON (u.user = r.role AND u.is_role = 'Y') " // We only care about users that have a default role assigned From 677023a18fe1f4b9cf9071701057b0ed739c94ae Mon Sep 17 00:00:00 2001 From: Timofey Turenko Date: Thu, 16 May 2019 14:36:37 +0300 Subject: [PATCH 3/3] Move version pronting from call_mdcbi() directly to TestConnectios() mdbci call can heppen before maxsales object creation and segfault hapens To avoid it call of ssh for 'maxscale --version-full' is moved to the end of Testconnections constructor --- maxscale-system-test/testconnections.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 8530274ed..ea397b7e2 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -439,6 +439,20 @@ TestConnections::TestConnections(int argc, char *argv[]): } } + if (mdbci_call_needed) + { + int ec; + char * ver = maxscales->ssh_node_output(0, "maxscale --version-full", false, &ec); + if (ec) + { + tprintf("Error retrival of Maxscale version info"); + } + else + { + tprintf("Maxscale_full_version_start:\n%s\nMaxscale_full_version_end\n", ver); + } + } + char str[1024]; sprintf(str, "mkdir -p LOGS/%s", test_name); system(str); @@ -2122,16 +2136,6 @@ int TestConnections::call_mdbci(const char * options) { maxscales->read_basic_env(); } - int ec; - char * ver = maxscales->ssh_node_output(0, "maxscale --version-full", false, &ec); - if (ec) - { - tprintf("Error retrival of Maxscale version info"); - } - else - { - tprintf("Maxscale_full_version_start:\n%s\nMaxscale_full_version_end\n", ver); - } return 0; }