| 1 |
--echo # |
| 2 |
--echo ## Preamble |
| 3 |
--echo # |
| 4 |
--source include/xplugin_preamble.inc |
| 5 |
|
| 6 |
--echo # |
| 7 |
--echo ## Testcase prepare |
| 8 |
--echo # |
| 9 |
|
| 10 |
--write_file $MYSQL_TMP_DIR/connection_default_schema_manual.tmp |
| 11 |
-->import connection.macro |
| 12 |
|
| 13 |
-->newsession non_root_user - |
| 14 |
-->callmacro Verify_its_xprotocol_connection |
| 15 |
-->login user_with_access_to_ydb ydb |
| 16 |
-->closesession |
| 17 |
|
| 18 |
-->newsession non_root_user - |
| 19 |
-->callmacro Verify_its_xprotocol_connection |
| 20 |
-->expecterror ER_DBACCESS_DENIED_ERROR |
| 21 |
-->login user_with_access_to_ydb xdb |
| 22 |
-->closesession abort |
| 23 |
|
| 24 |
-->newsession root_user - |
| 25 |
-->callmacro Verify_its_xprotocol_connection |
| 26 |
-->expecterror ER_BAD_DB_ERROR |
| 27 |
-->login root non_existing_schema sha256_memory |
| 28 |
-->closesession abort |
| 29 |
|
| 30 |
EOF |
| 31 |
|
| 32 |
call mtr.add_suppression("Plugin mysqlx reported: '.*: Unsuccessful login attempt"); |
| 33 |
|
| 34 |
CREATE DATABASE xdb; |
| 35 |
CREATE DATABASE ydb; |
| 36 |
|
| 37 |
CREATE USER 'user_with_access_to_xdb'@'%'; |
| 38 |
CREATE USER 'user_with_access_to_ydb'@'%'; |
| 39 |
|
| 40 |
GRANT SELECT ON xdb.* TO 'user_with_access_to_xdb'@'%'; |
| 41 |
GRANT SELECT ON ydb.* TO 'user_with_access_to_ydb'@'%'; |
| 42 |
|
| 43 |
|
| 44 |
--echo # |
| 45 |
--echo ## Testcase execute |
| 46 |
--echo # |
| 47 |
|
| 48 |
|
| 49 |
--echo # |
| 50 |
--echo ## Test group 1. |
| 51 |
--echo ## |
| 52 |
--echo ## Authenticate using plain X Protocol flows to schema that: |
| 53 |
--echo ## |
| 54 |
--echo ## * account has permissions |
| 55 |
--echo ## * account has not permissions |
| 56 |
--echo ## * account has permissions still db-doesn't exist |
| 57 |
--echo # |
| 58 |
|
| 59 |
exec $MYSQLXTEST |
| 60 |
-uroot |
| 61 |
--ssl-mode=REQUIRED |
| 62 |
-f $MYSQL_TMP_DIR/connection_default_schema_manual.tmp; |
| 63 |
|
| 64 |
|
| 65 |
--echo # |
| 66 |
--echo ## Test group 2. |
| 67 |
--echo ## |
| 68 |
--echo ## Authenticate using an account which has permissions |
| 69 |
--echo ## to selected schema. |
| 70 |
--echo # |
| 71 |
--echo |
| 72 |
--echo # Using MySQL client |
| 73 |
let $execute_command=$MYSQL; |
| 74 |
let $user=user_with_access_to_xdb; |
| 75 |
let $schema=xdb; |
| 76 |
--source ../include/connection_default_schema.inc |
| 77 |
|
| 78 |
--echo |
| 79 |
--echo # Using mysqlxtest |
| 80 |
let $execute_command=$MYSQLXTEST; |
| 81 |
let $user=user_with_access_to_xdb; |
| 82 |
let $schema=xdb; |
| 83 |
--source ../include/connection_default_schema.inc |
| 84 |
|
| 85 |
|
| 86 |
--echo # |
| 87 |
--echo ## Test group 3. |
| 88 |
--echo ## |
| 89 |
--echo ## Authenticate using an account which has not permissions |
| 90 |
--echo ## to selected schema. |
| 91 |
--echo # |
| 92 |
|
| 93 |
--echo |
| 94 |
--echo # Using MySQL client |
| 95 |
let $execute_command=$MYSQL; |
| 96 |
let $user=user_with_access_to_xdb; |
| 97 |
let $schema=ydb; |
| 98 |
let $expect_error=ERROR 1044 ; |
| 99 |
--source ../include/connection_default_schema.inc |
| 100 |
|
| 101 |
--echo |
| 102 |
--echo # Using mysqlxtest |
| 103 |
let $execute_command=$MYSQLXTEST --history-protocol false; |
| 104 |
let $user=user_with_access_to_xdb; |
| 105 |
let $schema=ydb; |
| 106 |
let $expect_error=code 1044; |
| 107 |
--source ../include/connection_default_schema.inc |
| 108 |
|
| 109 |
|
| 110 |
--echo # |
| 111 |
--echo ## Test group 4. |
| 112 |
--echo ## |
| 113 |
--echo ## Authenticate using an valid account to non existing |
| 114 |
--echo ## schema. |
| 115 |
--echo # |
| 116 |
|
| 117 |
|
| 118 |
--echo |
| 119 |
--echo # Using MySQL client |
| 120 |
let $execute_command=$MYSQL; |
| 121 |
let $user=root; |
| 122 |
let $schema=non_existing_schema; |
| 123 |
let $expect_error=ERROR 1049 ; |
| 124 |
--source ../include/connection_default_schema.inc |
| 125 |
|
| 126 |
--echo |
| 127 |
--echo # Using mysqlxtest |
| 128 |
let $execute_command=$MYSQLXTEST --history-protocol false; |
| 129 |
let $user=root; |
| 130 |
let $schema=non_existing_schema; |
| 131 |
let $expect_error=code 1049; |
| 132 |
--source ../include/connection_default_schema.inc |
| 133 |
|
| 134 |
|
| 135 |
--echo # |
| 136 |
--echo ## Cleanup |
| 137 |
--echo # |
| 138 |
|
| 139 |
--remove_file $MYSQL_TMP_DIR/connection_default_schema_manual.tmp |
| 140 |
|
| 141 |
DROP USER 'user_with_access_to_xdb'@'%'; |
| 142 |
DROP USER 'user_with_access_to_ydb'@'%'; |
| 143 |
|
| 144 |
DROP DATABASE xdb; |
| 145 |
DROP DATABASE ydb; |
| 146 |
|