Debian Codegraph @

mysql-test/suite/x/include/connection_skip_grant_table.inc

raw
1 ## This is test file for connection authentication using mysqlx.
2 --source include/xplugin_create_user.inc
3 eval CREATE USER nonblank@localhost
4 IDENTIFIED WITH $USER_AUTH_PLUGIN BY 'valid_password';
5
6 --write_file $MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl
7 -->sql
8 select user(),current_user(),@@bind_address;
9 -->endsql
10 EOF
11
12 --write_file $MYSQL_TMP_DIR/mysqlx-connection_uninstallplugin.xpl
13 -->expecterror ER_PLUGGABLE_PROTOCOL_COMMAND_NOT_SUPPORTED
14 -->sql
15 uninstall plugin mysqlx;
16 -->endsql
17 EOF
18
19 --echo Test starts here
20
21 exec $MYSQLXTEST $USER_CIPHER
22 --user nonblank
23 --password='valid_password'
24 --socket=$MASTER_X_MYSOCK
25 --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1;
26
27 --echo
28 --echo #
29 --echo # Try login with valid user when server started with
30 --echo # skip-grant-tables and mysqlx loaded
31 --echo #
32
33 --replace_regex /\.dll/.so/
34 --let $wait_for_tcpsocket_status = undefined_value
35 --let $restart_parameters = restart: --skip-grant-tables
36 --source ../include/restart_mysqld_and_wait_for_xplugin.inc
37
38 --echo
39 --echo #
40 --echo # Connection should success with valid password
41 exec $MYSQLXTEST $USER_CIPHER
42 --socket=$MASTER_X_MYSOCK
43 --user nonblank
44 --password='valid_password'
45 --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1;
46
47 --echo
48 --echo #
49 --echo # Connection should success with invalid password
50 exec $MYSQLXTEST $USER_CIPHER
51 --user nonblank
52 --password='invalid'
53 --socket=$MASTER_X_MYSOCK
54 --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1;
55
56 --echo
57 --echo #
58 --echo # Uninstall mysqlx plugin when the server is started with
59 --echo # skip-grant-tables option
60 exec $MYSQLXTEST
61 --socket=$MASTER_X_MYSOCK
62 --user root
63 --password=''
64 --file=$MYSQL_TMP_DIR/mysqlx-connection_uninstallplugin.xpl 2>&1;
65
66 --echo
67 --echo #
68 --echo # Enable back the "grant-tables", mysqlx client
69 --echo # that uses invalid passord must be disconnected
70 FLUSH PRIVILEGES;
71 exec $MYSQLXTEST $USER_CIPHER
72 --expect-error ER_ACCESS_DENIED_ERROR
73 --socket=$MASTER_X_MYSOCK
74 --user nonblank
75 --password='invalid'
76 --file=$MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl 2>&1;
77
78 #
79 # Cleanup
80 #
81 --let $restart_parameters = restart:
82 --source include/restart_mysqld.inc
83
84 --remove_file $MYSQL_TMP_DIR/mysqlx-connection_current_user.xpl
85
86 --source ../include/xplugin_cleanup.inc
87 DROP USER nonblank@localhost;