← Back to team overview

maria-developers team mailing list archive

Re: [Commits] 2606b87: MDEV-9117: Client Server capability negotiation for MariaDB specific functionality


On 24.11.15 12:27, Sergei Golubchik wrote:
Hi, Oleksandr!

On Nov 23, Oleksandr Byelkin wrote:
diff --git a/include/mysql.h b/include/mysql.h
index f088ad6..d398734 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -270,7 +270,7 @@ typedef struct st_mysql
     unsigned long thread_id;		/* Id for connection in server */
     unsigned long packet_length;
     unsigned int	port;
-  unsigned long client_flag,server_capabilities;
+  unsigned long long client_flag,server_capabilities;
This is an incompatible change, it breaks the ABI.
If we have to have this change in libmysqlclient, you can put the new
flags in the extension area. But, really, perhaps you should switch to
The problem is that we have to remove CLIENT_PROGRESS (there is no such
flag in mysql)
Right. So either we can keep CLIENT_PROGRESS in libmysqlclient or remove
it. As we're moving to Connector/C, I think it might be ok to remove it,
for MySQL compatibility. Or we can keep it for a while, for
compatibility with older MariaDB clients.

Either change does not break the ABI.
OK, then I'll also remove client translation of PROGRESS you liked (as well as all client code).
     unsigned int	protocol_version;
     unsigned int	field_count;
     unsigned int 	server_status;
diff --git a/sql-common/client.c b/sql-common/client.c
index 609eef5..e108c4b 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2672,15 +2673,26 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
     if (mysql->client_flag & CLIENT_PROTOCOL_41)
       /* 4.1 server and 4.1 client has a 32 byte option flag */
-    int4store(buff,mysql->client_flag);
+    bzero(buff+9, 32-9);
+    if (mysql->server_capabilities & MARIADB_CLIENT_EXTENDED_FLAGS)
+    {
+      DBUG_ASSERT(mysql->client_flag & CLIENT_LONG_PASSWORD);
1. add DBUG_ASSERT(mysql->client_flag & CLIENT_PROTOCOL_41)
2. define CLIENT_LONG_PASSWORD to be 0 and CLIENT_MYSQL to be 1.
I found that CLIENT_LONG_PASSWORD used without CLIENT_PROTOCOL_41in
mysqlbinlog. it will be wrong with CLIENT_LONG_PASSWORD defined as 0
Why wrong? Check the code - CLIENT_LONG_PASSWORD is *never* checked,
there is no code that does

   if (flags & CLIENT_LONG_PASSWORD) ...

no logic depends on it. That's why I'm saying that it's not used, and
should be renamed to match its new meaning.

diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 98f42ff..255ac25 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -16186,6 +16186,10 @@ static void test_change_user()
     sprintf(buff, "drop database if exists %s", db);
     rc= mysql_query(mysql, buff);
+  sprintf(buff, "set local sql_mode=''");
Otherwise it can't make grant.
What do you mean? How does it work now?
I have no idea (probably it saves by change other connection where other test set sql_mode=''). If run the same commands manually you will get an error:

bell@bell-ThinkPad:~/maria/git/server$ ./client/mysql --user=root --socket=/home/bell/maria/git/server/mysql-test/var/tmp/mysqld.1.sock
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.9-MariaDB-debug-log Source distribution

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database mysqltest_user_test_database;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant select on mysqltest_user_test_database.* to mysqltest_pw@'%' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant select on mysqltest_user_test_database.* to mysqltest_pw@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant select on mysqltest_user_test_database.* to mysqltest_no_pw@'%';
ERROR 1133 (28000): Can't find any matching row in the user table
MariaDB [(none)]>

Follow ups