Skip to content

Commit 03a0150

Browse files
Bug#29395944: SOME FUNCTION PROBLEM WHILE CREATE AN USER
Description: CREATE USER and ALTER USER statement should check validity of authentication string. RB: 22001
1 parent 8c33f42 commit 03a0150

9 files changed

+65
-79
lines changed

mysql-test/r/grant_alter_user_qa.result

+17-19
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ SELECT USER();
6262
USER()
6363
u4@localhost
6464

65-
CREATE USER user4@localhost IDENTIFIED WITH 'sha256_password' AS 'auth_string';
65+
CREATE USER user4@localhost IDENTIFIED WITH 'sha256_password' BY 'auth_string';
6666
SELECT User,plugin,authentication_string FROM mysql.user
6767
WHERE USER='user4';
6868
User user4
@@ -308,7 +308,7 @@ u19@localhost IDENTIFIED BY 'auth_string',
308308
u20@localhost IDENTIFIED WITH 'sha256_password',
309309
u21@localhost IDENTIFIED WITH 'sha256_password' BY 'auth_string',
310310
u22@localhost IDENTIFIED WITH 'test_plugin_server',
311-
u23@localhost IDENTIFIED WITH 'mysql_native_password' AS 'auth_&string'
311+
u23@localhost IDENTIFIED WITH 'mysql_native_password' BY 'auth_string'
312312
REQUIRE SUBJECT '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client'
313313
WITH MAX_QUERIES_PER_HOUR 2 MAX_USER_CONNECTIONS 2;
314314
SELECT User,plugin,authentication_string,ssl_type,ssl_cipher,
@@ -758,7 +758,7 @@ authentication_string #
758758
password_expired N
759759
password_last_changed #
760760
password_lifetime NULL
761-
CREATE USER u10@localhost IDENTIFIED WITH 'sha256_password' AS 'auth_string'
761+
CREATE USER u10@localhost IDENTIFIED WITH 'sha256_password' BY 'auth_string'
762762
REQUIRE CIPHER "DHE-RSA-AES256-SHA" AND
763763
SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client"
764764
ISSUER "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA";
@@ -1003,7 +1003,7 @@ u19@localhost IDENTIFIED BY 'auth_string',
10031003
u20@localhost IDENTIFIED WITH 'sha256_password',
10041004
u21@localhost IDENTIFIED WITH 'sha256_password' BY '!Y_TOdh6)',
10051005
u22@localhost IDENTIFIED WITH 'sha256_password',
1006-
u23@localhost IDENTIFIED WITH 'sha256_password' AS 'auth_&string'
1006+
u23@localhost IDENTIFIED WITH 'sha256_password' BY 'auth_&string'
10071007
REQUIRE SUBJECT '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client'
10081008
WITH MAX_QUERIES_PER_HOUR 2 MAX_USER_CONNECTIONS 2;
10091009
SELECT User,ssl_type,ssl_cipher,x509_issuer,x509_subject,
@@ -1282,12 +1282,12 @@ CREATE USER u4@localhost IDENTIFIED WITH 'sha256_password' BY 'auth_string';
12821282
SHOW CREATE USER u4@localhost;
12831283
CREATE USER for u4@localhost
12841284
CREATE USER 'u4'@'localhost' IDENTIFIED WITH 'sha256_password' AS '<non-deterministic-password-hash>' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK
1285-
CREATE USER user1@localhost IDENTIFIED WITH 'sha256_password' AS 'auth_string';
1285+
CREATE USER user1@localhost IDENTIFIED WITH 'sha256_password' BY 'auth_string';
12861286
SHOW CREATE USER user1@localhost;
12871287
CREATE USER for user1@localhost
12881288
CREATE USER 'user1'@'localhost' IDENTIFIED WITH 'sha256_password' AS '<non-deterministic-password-hash>' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK
12891289

1290-
CREATE USER user2@localhost IDENTIFIED WITH 'mysql_native_password' AS 'auth_string';
1290+
CREATE USER user2@localhost IDENTIFIED WITH 'mysql_native_password' BY 'auth_string';
12911291
SHOW CREATE USER user2@localhost;
12921292
CREATE USER for user2@localhost
12931293
CREATE USER 'user2'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '<non-deterministic-password-hash>' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK
@@ -1400,7 +1400,7 @@ u14@localhost,u15@localhost;
14001400

14011401
# GRANT
14021402

1403-
CREATE USER user1@localhost IDENTIFIED WITH 'sha256_password'
1403+
CREATE USER user1@localhost IDENTIFIED WITH 'mysql_native_password'
14041404
AS '*67092806AE91BFB6BE72DE6C7BE2B7CCA8CFA9DF'
14051405
REQUIRE SUBJECT '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client'
14061406
ISSUER "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA"
@@ -1411,7 +1411,7 @@ x509_issuer,x509_subject,max_user_connections,
14111411
max_questions,max_updates,max_connections FROM mysql.user
14121412
WHERE USER='user1';
14131413
user user1
1414-
plugin sha256_password
1414+
plugin mysql_native_password
14151415
authentication_string #
14161416
ssl_type SPECIFIED
14171417
ssl_cipher
@@ -1486,7 +1486,7 @@ DROP USER user1@localhost,user2@localhost,user3@localhost,user5@localhost;
14861486
# SET PASSWORD Tests
14871487

14881488
CREATE USER user1@localhost IDENTIFIED BY 'auth_string';
1489-
CREATE USER user2@localhost IDENTIFIED WITH 'sha256_password' AS 'auth_string1';
1489+
CREATE USER user2@localhost IDENTIFIED WITH 'sha256_password' BY 'auth_string1';
14901490
SELECT PASSWORD('plaintext_pwd');
14911491
PASSWORD('plaintext_pwd')
14921492
*F42EC6870C44E0E26316EC1D4A953A4B9C2D8958
@@ -1652,7 +1652,7 @@ CREATE USER u10@localhost IDENTIFIED WITH 'sha256_password'
16521652
SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client"
16531653
ISSUER "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA"
16541654
WITH MAX_QUERIES_PER_HOUR 2 MAX_USER_CONNECTIONS 2;
1655-
ALTER USER u10@localhost IDENTIFIED WITH 'mysql_native_password' AS 'auth_string'
1655+
ALTER USER u10@localhost IDENTIFIED WITH 'mysql_native_password' BY 'auth_string'
16561656
REQUIRE SSL;
16571657
ALTER USER user11@localhost IDENTIFIED WITH 'sha256_password'
16581658
REQUIRE CIPHER "DHE-RSA-AES256-SHA" AND
@@ -1705,7 +1705,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
17051705
0.000001 # Query # # use `test`; CREATE USER 'user12'@'localhost' IDENTIFIED WITH 'sha256_password' PASSWORD EXPIRE NEVER
17061706
0.000001 # Query # # use `test`; CREATE USER 'u2'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*82DC221D557298F6CE9961037DB1C90604792F5C'
17071707
0.000001 # Query # # use `test`; CREATE USER 'u10'@'localhost' IDENTIFIED WITH 'sha256_password' REQUIRE SUBJECT '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client' ISSUER '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA' CIPHER 'DHE-RSA-AES256-SHA' WITH MAX_QUERIES_PER_HOUR 2 MAX_USER_CONNECTIONS 2
1708-
0.000001 # Query # # use `test`; ALTER USER 'u10'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS 'auth_string' REQUIRE SSL
1708+
0.000001 # Query # # use `test`; ALTER USER 'u10'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*67092806AE91BFB6BE72DE6C7BE2B7CCA8CFA9DF' REQUIRE SSL
17091709
0.000001 # Query # # use `test`; ALTER USER 'user11'@'localhost' IDENTIFIED WITH 'sha256_password' REQUIRE SUBJECT '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client' ISSUER '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA' CIPHER 'DHE-RSA-AES256-SHA' PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK
17101710
0.000001 # Query # # use `test`; ALTER USER 'user12'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*67092806AE91BFB6BE72DE6C7BE2B7CCA8CFA9DF' PASSWORD EXPIRE INTERVAL 90 DAY ACCOUNT UNLOCK
17111711
0.000001 # Query # # use `test`; CREATE USER 'user13'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*67092806AE91BFB6BE72DE6C7BE2B7CCA8CFA9DF' ACCOUNT UNLOCK
@@ -1745,7 +1745,7 @@ CREATE USER u10@localhost IDENTIFIED WITH 'sha256_password'
17451745
SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client"
17461746
ISSUER "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA"
17471747
WITH MAX_QUERIES_PER_HOUR 2 MAX_USER_CONNECTIONS 2;
1748-
ALTER USER u10@localhost IDENTIFIED WITH 'mysql_native_password' AS 'auth_string'
1748+
ALTER USER u10@localhost IDENTIFIED WITH 'mysql_native_password' BY 'auth_string'
17491749
REQUIRE SSL;
17501750
ALTER USER user11@localhost IDENTIFIED WITH 'sha256_password'
17511751
REQUIRE CIPHER "DHE-RSA-AES256-SHA" AND
@@ -1816,8 +1816,7 @@ CREATE USER user16@localhost IDENTIFIED BY PASSWORD '*67092806AE91BFB6BE72DE6C7B
18161816
CREATE USER user10@localhost IDENTIFIED BY PASSWORD '*67092806AE91BFB6BE72DE6C7BE2B7CCA8CFA9DF'
18171817
SELECT argument FROM mysql.general_log WHERE argument LIKE 'ALTER USER %';
18181818
argument
1819-
ALTER USER u10@localhost IDENTIFIED WITH 'mysql_native_password' AS 'auth_string'
1820-
REQUIRE SSL
1819+
ALTER USER 'u10'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '<secret>' REQUIRE SSL
18211820
ALTER USER user11@localhost IDENTIFIED WITH 'sha256_password'
18221821
REQUIRE CIPHER "DHE-RSA-AES256-SHA" AND
18231822
SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client"
@@ -1874,7 +1873,7 @@ CREATE USER u10@localhost IDENTIFIED WITH 'sha256_password'
18741873
SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client"
18751874
ISSUER "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA"
18761875
WITH MAX_QUERIES_PER_HOUR 2 MAX_USER_CONNECTIONS 2;
1877-
ALTER USER u10@localhost IDENTIFIED WITH 'mysql_native_password' AS 'auth_string'
1876+
ALTER USER u10@localhost IDENTIFIED WITH 'mysql_native_password' BY 'auth_string'
18781877
REQUIRE SSL;
18791878
ALTER USER user11@localhost IDENTIFIED WITH 'sha256_password'
18801879
REQUIRE CIPHER "DHE-RSA-AES256-SHA" AND
@@ -1927,7 +1926,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
19271926
0.000001 # Query # # use `test`; CREATE USER 'user12'@'localhost' IDENTIFIED WITH 'sha256_password' PASSWORD EXPIRE NEVER
19281927
0.000001 # Query # # use `test`; CREATE USER 'u2'@'localhost' IDENTIFIED BY PASSWORD '*9DEEEFA46E24839BE7F9A49992E9ACA90FE30950'
19291928
0.000001 # Query # # use `test`; CREATE USER 'u10'@'localhost' IDENTIFIED WITH 'sha256_password' REQUIRE SUBJECT '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client' ISSUER '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA' CIPHER 'DHE-RSA-AES256-SHA' WITH MAX_QUERIES_PER_HOUR 2 MAX_USER_CONNECTIONS 2
1930-
0.000001 # Query # # use `test`; ALTER USER 'u10'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS 'auth_string' REQUIRE SSL
1929+
0.000001 # Query # # use `test`; ALTER USER 'u10'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*67092806AE91BFB6BE72DE6C7BE2B7CCA8CFA9DF' REQUIRE SSL
19311930
0.000001 # Query # # use `test`; ALTER USER 'user11'@'localhost' IDENTIFIED WITH 'sha256_password' REQUIRE SUBJECT '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client' ISSUER '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA' CIPHER 'DHE-RSA-AES256-SHA' PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK
19321931
0.000001 # Query # # use `test`; ALTER USER 'user12'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*67092806AE91BFB6BE72DE6C7BE2B7CCA8CFA9DF' PASSWORD EXPIRE INTERVAL 90 DAY ACCOUNT UNLOCK
19331932
0.000001 # Query # # use `test`; CREATE USER 'user13'@'localhost' IDENTIFIED BY PASSWORD '*173F3D05EA1CE4F97ECFD8A770A25A5739FE1EBE' ACCOUNT UNLOCK
@@ -1968,7 +1967,7 @@ CREATE USER u10@localhost IDENTIFIED WITH 'sha256_password'
19681967
SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client"
19691968
ISSUER "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=CA"
19701969
WITH MAX_QUERIES_PER_HOUR 2 MAX_USER_CONNECTIONS 2;
1971-
ALTER USER u10@localhost IDENTIFIED WITH 'mysql_native_password' AS 'auth_string'
1970+
ALTER USER u10@localhost IDENTIFIED WITH 'mysql_native_password' BY 'auth_string'
19721971
REQUIRE SSL;
19731972
ALTER USER user11@localhost IDENTIFIED WITH 'sha256_password'
19741973
REQUIRE CIPHER "DHE-RSA-AES256-SHA" AND
@@ -2043,8 +2042,7 @@ CREATE USER user10@localhost
20432042
IDENTIFIED BY PASSWORD '*67092806AE91BFB6BE72DE6C7BE2B7CCA8CFA9DF'
20442043
SELECT argument FROM mysql.general_log WHERE argument LIKE 'ALTER USER %';
20452044
argument
2046-
ALTER USER u10@localhost IDENTIFIED WITH 'mysql_native_password' AS 'auth_string'
2047-
REQUIRE SSL
2045+
ALTER USER 'u10'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '<secret>' REQUIRE SSL
20482046
ALTER USER user11@localhost IDENTIFIED WITH 'sha256_password'
20492047
REQUIRE CIPHER "DHE-RSA-AES256-SHA" AND
20502048
SUBJECT "/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client"

mysql-test/r/grant_user_lock_qa.result

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ SELECT USER();
266266
USER()
267267
u4@localhost
268268

269-
CREATE USER user4@localhost IDENTIFIED WITH 'sha256_password' AS 'auth_string'
269+
CREATE USER user4@localhost IDENTIFIED WITH 'sha256_password' BY 'auth_string'
270270
ACCOUNT LOCK PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK PASSWORD EXPIRE INTERVAL 90 DAY;
271271
SELECT user,plugin,authentication_string,password_expired,
272272
password_lifetime,account_locked FROM mysql.user WHERE USER='user4';

0 commit comments

Comments
 (0)