summaryrefslogtreecommitdiff
path: root/mysql-test/t/change_user.test
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-11-25 18:17:28 +0100
committerSergei Golubchik <sergii@pisem.net>2010-11-25 18:17:28 +0100
commit65ca700def99289cc31a7040537f5aa6e12bf485 (patch)
tree97b3a07299b626c519da0e80c122b5b79b933914 /mysql-test/t/change_user.test
parent2ab57de38d13d927ddff2d51aed4af34e13998f5 (diff)
parent6e5bcca7935d3c62f84bb640e5357664a210ee12 (diff)
downloadmariadb-git-65ca700def99289cc31a7040537f5aa6e12bf485.tar.gz
merge.
checkpoint. does not compile.
Diffstat (limited to 'mysql-test/t/change_user.test')
-rw-r--r--mysql-test/t/change_user.test66
1 files changed, 64 insertions, 2 deletions
diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test
index 3ed798e8d36..b4ac526a80e 100644
--- a/mysql-test/t/change_user.test
+++ b/mysql-test/t/change_user.test
@@ -1,5 +1,63 @@
#
+# functional change user tests
+#
+
+grant select on test.* to test_nopw;
+grant select on test.* to test_oldpw identified by password "09301740536db389";
+grant select on test.* to test_newpw identified by "newpw";
+
+select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
+
+#
+# massaging the data for tests to pass in the embedded server,
+# that has authentication completely disabled or, if enabled, can
+# only do new auth (20-byte scramble).
+#
+
+change_user test_nopw;
+--replace_result <@> <test_nopw@%> @> @localhost>
+select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
+
+#
+# embedded with enabled privilege control cannot do plugin negotiation.
+# that is, it cannot try to authenticate with a new scramble, receive a request
+# to switch to an old scramble, and retry with an old scramble.
+# As a result, it cannot change to a user that has old scramble and
+# and it stays logged as a previous user - test_nopw in this test file.
+# For the embedded with auth we replace nopw with oldpw in the results.
+#
+let $repl = `select if(version() like '%embedded%' and user() like '%nopw%', 'nopw', 'oldpw')`;
+
+change_user test_oldpw, oldpw;
+--replace_result <@> <test_oldpw@%> @> @localhost> $repl oldpw
+select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
+change_user test_newpw, newpw;
+--replace_result <@> <test_newpw@%> @> @localhost>
+select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
+change_user root;
+--replace_result <@> <root@localhost> @> @localhost>
+select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
+
+change_user test_nopw,,test;
+--replace_result <@> <test_nopw@%> @> @localhost>
+select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
+change_user test_oldpw,oldpw,test;
+--replace_result <@> <test_oldpw@%> @> @localhost> $repl oldpw
+select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
+change_user test_newpw,newpw,test;
+--replace_result <@> <test_newpw@%> @> @localhost>
+select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
+change_user root,,test;
+--replace_result <@> <root@localhost> @> @localhost>
+select concat('<', user(), '>'), concat('<', current_user(), '>'), database();
+
+drop user test_nopw;
+drop user test_oldpw;
+drop user test_newpw;
+
+#
# Bug#20023 mysql_change_user() resets the value of SQL_BIG_SELECTS
+# The replace's are here to fix things for 32 bit systems
#
--echo Bug#20023
@@ -26,6 +84,10 @@ SET @@session.max_join_size = default;
--echo change_user
--change_user
SELECT @@session.sql_big_selects;
+--replace_result 4294967295 18446744073709551615
+SELECT @@global.max_join_size;
+--replace_result 4294967295 18446744073709551615
+SELECT @@session.max_join_size;
#
# Bug#31418 User locks misfunctioning after mysql_change_user()
@@ -52,13 +114,13 @@ FLUSH STATUS;
--disable_query_log
let $i = 100;
-
+begin;
while ($i)
{
dec $i;
-
SELECT 1;
}
+commit;
--enable_query_log
--enable_result_log