1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
|
# The numbers represent test cases of the test plan.
--source include/have_plugin_auth.inc
--source include/not_embedded.inc
CREATE DATABASE test_user_db;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
--echo ========== test 1.1 ======================================================
# without '', without AS part
CREATE USER plug IDENTIFIED WITH test_plugin_server;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
DROP USER plug;
# with '', without AS part
CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
DROP USER plug;
# without '', AS part empty
CREATE USER plug IDENTIFIED WITH test_plugin_server AS '';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS '';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug;
DROP USER plug;
# with '', AS part empty without ''
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ;
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS;
# without '', AS part without ''
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH test_plugin_server AS plug_dest;
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS plug_dest;
--echo ========== test 1.1 syntax errors ========================================
# without auth_name
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH AS plug_dest;
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH AS plug_dest;
# without auth_name and AS part
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH;
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH;
# without auth_name but AS part
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED AS '';
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED AS '';
# with 2 auth_name parts
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug
IDENTIFIED WITH 'test_plugin_server' IDENTIFIED WITH 'test_plugin_server';
# with 2 AS parts
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS '' AS 'plug_dest';
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug AS '' AS 'plug_dest';
# with 2 complete WITH parts
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS ''
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS ''
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
# with BY and WITH part
--error ER_PARSE_ERROR
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'
IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd'
IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
# with WITH part and BY part
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
USER plug_dest IDENTIFIED by 'plug_dest_pwd';
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
USER plug_dest IDENTIFIED by 'plug_dest_pwd';
# with WITH part and BY part
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
plug_dest IDENTIFIED by 'plug_dest_pwd';
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
plug_dest IDENTIFIED by 'plug_dest_pwd';
# with WITH part and BY part
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
IDENTIFIED by 'plug_dest_pwd';
--error ER_PARSE_ERROR
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'
IDENTIFIED by 'plug_dest_pwd';
--echo ========== test 1.1 combinations ==========================
# CREATE...WITH/CREATE...BY
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
--echo ========== test 1.1.1.6/1.1.2.5 ============================
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug, plug_dest;
#
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug;
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug_dest;
# GRANT...WITH/CREATE...BY
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug, plug_dest;
#
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug;
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug_dest;
# CREATE...WITH/GRANT...BY
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug, plug_dest;
#
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug_dest;
#
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server';
DROP USER plug;
#
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
--error ER_CANNOT_USER
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
--error ER_CANNOT_USER
CREATE USER plug IDENTIFIED WITH 'test_plugin_server';
DROP USER plug;
#
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
DROP USER plug;
#
GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest';
--error ER_CANNOT_USER
CREATE USER plug IDENTIFIED BY 'plug_dest_passwd';
DROP USER plug;
#
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
CREATE USER plug_dest IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
DROP USER plug,plug_dest;
#
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest
IDENTIFIED WITH test_plugin_server AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
DROP USER plug,plug_dest;
#
--echo ========== test 1.1.1.1/1.1.2.1/1.1.1.5 ====================
SET NAMES utf8;
#
CREATE USER plüg IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plüg;
CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plüg_dest;
SET NAMES ascii;
#
CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER 'plüg';
CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER 'plüg_dest';
SET NAMES latin1;
#
--echo ========== test 1.1.1.5 ====================================
--error ER_PLUGIN_IS_NOT_LOADED
CREATE USER 'plüg' IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
CREATE USER 'plug' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER 'plug';
CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER 'plüg_dest';
SET NAMES utf8;
#
--error ER_PLUGIN_IS_NOT_LOADED
CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest';
CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER 'plüg';
CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER 'plüg_dest';
CREATE USER plüg IDENTIFIED WITH test_plugin_server AS 'plüg_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plüg;
CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plüg_dest;
--echo ========== test 1.1.1.2/1.1.2.2=============================
SET @auth_name= 'test_plugin_server';
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH @auth_name AS 'plug_dest';
SET @auth_string= 'plug_dest';
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH test_plugin_server AS @auth_string;
--echo ========== test 1.1.1.3/1.1.2.3=============================
--error ER_PLUGIN_IS_NOT_LOADED
CREATE USER plug IDENTIFIED WITH 'hh''s_test_plugin_server' AS 'plug_dest';
CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'hh''s_plug_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER plug;
CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER 'hh''s_plug_dest';
--echo ========== test 1.1.1.4 ====================================
--error ER_PARSE_ERROR
CREATE USER plug IDENTIFIED WITH hh''s_test_plugin_server AS 'plug_dest';
--echo ========== test 1.1.3.1 ====================================
GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
CREATE USER plug_dest;
DROP USER plug_dest;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
DROP USER grant_user,plug_dest;
#
set @save_sql_mode= @@sql_mode;
SET @@sql_mode=no_auto_create_user;
GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
CREATE USER plug_dest;
DROP USER plug_dest;
--error ER_PASSWORD_NO_MATCH
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest;
DROP USER grant_user;
#
GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest';
--sorted_result
SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root';
CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd';
--sorted_result
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
DROP USER plug_dest;
GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd';
--sorted_result
SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root';
DROP USER grant_user,plug_dest;
set @@sql_mode= @save_sql_mode;
#
DROP DATABASE test_user_db;
--exit
|