diff --git a/include/maxscale/protocol/mysql.hh b/include/maxscale/protocol/mysql.hh index fd36b84fa..9a61872f9 100644 --- a/include/maxscale/protocol/mysql.hh +++ b/include/maxscale/protocol/mysql.hh @@ -270,6 +270,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 c5e4d049b..6aeae5839 100644 --- a/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc +++ b/server/modules/protocol/MySQL/mariadbclient/mysql_client.cc @@ -693,7 +693,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) diff --git a/system-test/create_user.sh b/system-test/create_user.sh index 2ff10c209..90d4e0475 100755 --- a/system-test/create_user.sh +++ b/system-test/create_user.sh @@ -1,10 +1,15 @@ #!/bin/bash +# The following environment variables are used: +# node_user - A custom user to create +# node_password - The password for the user +# require_ssl - Require SSL for all users except the replication user + mysql --force $1 <& /dev/null DROP USER IF EXISTS '$node_user'@'%'; CREATE USER '$node_user'@'%' IDENTIFIED BY '$node_password'; -GRANT ALL PRIVILEGES ON *.* TO '$node_user'@'%' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON *.* TO '$node_user'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'repl'@'%'; CREATE USER 'repl'@'%' IDENTIFIED BY 'repl'; @@ -16,25 +21,25 @@ GRANT ALL ON *.* TO 'repl'@'localhost' WITH GRANT OPTION; DROP USER IF EXISTS 'skysql'@'%'; CREATE USER 'skysql'@'%' IDENTIFIED BY 'skysql'; -GRANT ALL ON *.* TO 'skysql'@'%' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'skysql'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'skysql'@'localhost'; DROP USER IF EXISTS 'maxskysql'@'%'; CREATE USER 'maxskysql'@'%' IDENTIFIED BY 'skysql'; -GRANT ALL ON *.* TO 'maxskysql'@'%' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxskysql'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'maxskysql'@'localhost'; CREATE USER 'maxskysql'@'localhost' IDENTIFIED BY 'skysql'; -GRANT ALL ON *.* TO 'maxskysql'@'localhost' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxskysql'@'localhost' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'maxuser'@'%'; CREATE USER 'maxuser'@'%' IDENTIFIED BY 'maxpwd'; -GRANT ALL ON *.* TO 'maxuser'@'%' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxuser'@'%' $require_ssl WITH GRANT OPTION; DROP USER IF EXISTS 'maxuser'@'localhost'; CREATE USER 'maxuser'@'localhost' IDENTIFIED BY 'maxpwd'; -GRANT ALL ON *.* TO 'maxuser'@'localhost' WITH GRANT OPTION; +GRANT ALL ON *.* TO 'maxuser'@'localhost' $require_ssl WITH GRANT OPTION; RESET MASTER; EOF diff --git a/system-test/create_user_ssl.sh b/system-test/create_user_ssl.sh index 463da6b1e..2190d3ee8 100755 --- a/system-test/create_user_ssl.sh +++ b/system-test/create_user_ssl.sh @@ -1,11 +1,4 @@ #!/bin/bash -echo "DROP USER '$node_user'@'%'" | sudo mysql $1 -echo "grant all privileges on *.* to '$node_user'@'%' identified by '$node_password' require ssl WITH GRANT OPTION" -echo "grant all privileges on *.* to '$node_user'@'%' identified by '$node_password' require ssl WITH GRANT OPTION" | sudo mysql $1 -echo "drop user '$node_user'@'localhost'" | sudo mysql $1 - -echo "grant all privileges on *.* to 'maxskysql'@'%' identified by 'skysql' require ssl WITH GRANT OPTION" | sudo mysql $1 -echo "grant all privileges on *.* to 'maxuser'@'%' identified by 'maxpwd' require ssl WITH GRANT OPTION" | sudo mysql $1 -echo "grant all privileges on *.* to 'maxskysql'@'localhost' identified by 'skysql' require ssl WITH GRANT OPTION" | sudo mysql $1 -echo "grant all privileges on *.* to 'maxuser'@'localhost' identified by 'maxpwd' require ssl WITH GRANT OPTION" | sudo mysql $1 +export require_ssl="REQUIRE SSL" +./create_user.sh $1 diff --git a/system-test/mxs1926_killed_server.cpp b/system-test/mxs1926_killed_server.cpp index 22c81a476..2bfae303b 100644 --- a/system-test/mxs1926_killed_server.cpp +++ b/system-test/mxs1926_killed_server.cpp @@ -54,7 +54,7 @@ void tune_rowcount(TestConnections& test) remove(filename.c_str()); int orig = ROWCOUNT; - ROWCOUNT = orig / dur.count() * 10000; + ROWCOUNT = orig / (dur.count() + 1) * 10000; test.tprintf("Loading %d rows took %ld ms, setting row count to %d", orig, dur.count(),