Debian Codegraph @

mysql-test/suite/auth_sec/t/server_send_client_plugin.test

raw
1 --source include/have_debug.inc
2
3 #
4 # Server should send client plugin name to client
5 # during first handshake sequence.
6 # (see WL14308)
7 #
8 CREATE USER u1 IDENTIFIED WITH 'mysql_native_password' BY 'foo';
9 CREATE USER u2 IDENTIFIED WITH 'caching_sha2_password' BY 'foo';
10 SHOW VARIABLES LIKE 'default_authentication_plugin';
11 SELECT user,plugin FROM mysql.user WHERE user='u1' or user='u2';
12 # Server will first be blocked from attempting to change
13 # the authentication plugin.
14 # This means we can assert that the client picks up the
15 # server recommended client plugin value rather
16 # than the default caching_sha2_password.
17 SET GLOBAL debug='+d,assert_authentication_roundtrips';
18 --connect(con1,localhost,u1,foo,,,,)
19 # Succeeds because server sent client plugin
20 # native password as default.
21 SELECT @@debug,current_user();
22 --connection default
23 # We attempt the same thing but with the caching_sha2_password
24 # this time our connection will fail because we use a different
25 # client plugin than the default which will provoke a request
26 # from the server to the client to switch.
27 --disable_query_log
28 --error ER_ACCESS_DENIED_ERROR
29 --connect(con2,localhost,u2,foo,,,,)
30 --connection default
31 --enable_query_log
32 # Just to be sure, we test the same without the error injection
33 SET GLOBAL debug='-d,assert_authentication_roundtrips';
34 --connect(con2,localhost,u2,foo,,,,)
35 # ..which should work just fine.
36 SELECT @@debug,current_user();
37 --connection default
38 DROP USER u1;
39 DROP USER u2;
40 --disconnect con1
41 --disconnect con2