Skip to content
/ server Public

Commit 348f061

Browse files
committed
MDEV-38431: add COM_CHANGE_USER test cases
Add tests for mysql_change_user() with database parameter: - Test 4: Short password - verifies basic COM_CHANGE_USER works - Test 5: Long password (260 bytes) - verifies LENENC encoding path
1 parent dcce9e7 commit 348f061

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

mysql-test/suite/plugins/r/mdev38431.result

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,25 @@ GRANT ALL ON *.* TO verylonguser;
2929
db
3030
mdev38431_db
3131
#
32+
# Test 4: COM_CHANGE_USER with short password
33+
# Verify mysql_change_user() works correctly with database parameter
34+
#
35+
CREATE USER changeusertest IDENTIFIED VIA cleartext_plugin_server USING 'changepwd';
36+
GRANT ALL ON *.* TO changeusertest;
37+
SELECT DATABASE() AS db;
38+
db
39+
mdev38431_db
40+
#
41+
# Test 5: COM_CHANGE_USER with long password (260 bytes)
42+
# Verify mysql_change_user() works with LENENC-encoded password
43+
#
44+
CREATE USER changeuserlongpwd IDENTIFIED VIA cleartext_plugin_server USING 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
45+
GRANT ALL ON *.* TO changeuserlongpwd;
46+
SELECT DATABASE() AS db;
47+
db
48+
mdev38431_db
49+
#
3250
# Cleanup
3351
#
34-
DROP USER shortuser, longuser, verylonguser;
52+
DROP USER shortuser, longuser, verylonguser, changeusertest, changeuserlongpwd;
3553
DROP DATABASE mdev38431_db;

mysql-test/suite/plugins/t/mdev38431.test

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,33 @@ GRANT ALL ON *.* TO verylonguser;
5151

5252
--exec $MYSQL -h 127.0.0.1 -P $MASTER_MYPORT --default-auth=mysql_clear_password -u verylonguser -p"$very_long_pwd" --database=mdev38431_db -e "SELECT DATABASE() AS db"
5353

54+
--echo #
55+
--echo # Test 4: COM_CHANGE_USER with short password
56+
--echo # Verify mysql_change_user() works correctly with database parameter
57+
--echo #
58+
CREATE USER changeusertest IDENTIFIED VIA cleartext_plugin_server USING 'changepwd';
59+
GRANT ALL ON *.* TO changeusertest;
60+
61+
# Use change_user command to switch user with password and database
62+
change_user changeusertest,changepwd,mdev38431_db;
63+
SELECT DATABASE() AS db;
64+
change_user root;
65+
66+
--echo #
67+
--echo # Test 5: COM_CHANGE_USER with long password (260 bytes)
68+
--echo # Verify mysql_change_user() works with LENENC-encoded password
69+
--echo #
70+
--let $change_pwd=`SELECT REPEAT('c', 260)`
71+
eval CREATE USER changeuserlongpwd IDENTIFIED VIA cleartext_plugin_server USING '$change_pwd';
72+
GRANT ALL ON *.* TO changeuserlongpwd;
73+
74+
change_user changeuserlongpwd,$change_pwd,mdev38431_db;
75+
SELECT DATABASE() AS db;
76+
change_user root;
77+
5478
--echo #
5579
--echo # Cleanup
5680
--echo #
57-
DROP USER shortuser, longuser, verylonguser;
81+
DROP USER shortuser, longuser, verylonguser, changeusertest, changeuserlongpwd;
5882
DROP DATABASE mdev38431_db;
5983
# Note: Do not uninstall cleartext_plugin_server as it was pre-loaded by MTR

0 commit comments

Comments
 (0)