summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnel Husakovic <anel@mariadb.org>2023-01-27 15:53:50 +0100
committerAnel Husakovic <anel@mariadb.org>2023-01-30 13:19:11 +0100
commit9590daf3e014d1990d6613dfc195003835573af9 (patch)
tree0a4232c185b602d1f643035510fdb7017e968806
parent49ee18eb422d7c2bc3b349eef4be9134816b066a (diff)
downloadmariadb-git-bb-10.5-anel-anonymous-user-windows-check-without-skip-resolve.tar.gz
Testing Windows bb without skip-name-resolvebb-10.5-anel-anonymous-user-windows-check-without-skip-resolve
-rw-r--r--mysql-test/main/anel.result22
-rw-r--r--mysql-test/main/anel.test24
2 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/main/anel.result b/mysql-test/main/anel.result
new file mode 100644
index 00000000000..a7f2a519ccd
--- /dev/null
+++ b/mysql-test/main/anel.result
@@ -0,0 +1,22 @@
+# Verify anonymous user on Windows is not 'Administrator'
+#
+# Test of anonymous user connection
+--------------------------------------------------------------
+create role test_role;
+grant test_role to ''@localhost;
+connect con1,localhost,'',,,$MASTER_MYPORT;
+SELECT CURRENT_ROLE;
+CURRENT_ROLE
+NULL
+SET role test_role;
+SELECT CURRENT_ROLE;
+CURRENT_ROLE
+test_role
+SET role new_role;
+ERROR OP000: Invalid role specification `new_role`
+set default role test_role for ''@localhost;
+ERROR 42000: You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings
+connection default;
+disconnect con1;
+REVOKE all privileges, grant option from ''@localhost;
+drop role test_role;
diff --git a/mysql-test/main/anel.test b/mysql-test/main/anel.test
new file mode 100644
index 00000000000..d31205cff9b
--- /dev/null
+++ b/mysql-test/main/anel.test
@@ -0,0 +1,24 @@
+--echo # Verify anonymous user on Windows is not 'Administrator'
+--echo #
+--echo # Test of anonymous user connection
+--echo --------------------------------------------------------------
+--source include/add_anonymous_users.inc
+
+create role test_role;
+grant test_role to ''@localhost;
+
+connect(con1,localhost,'',,,$MASTER_MYPORT);
+SELECT CURRENT_ROLE;
+SET role test_role;
+SELECT CURRENT_ROLE;
+# user cannot set subset role, since it is not granted explicitly
+--error ER_INVALID_ROLE
+SET role new_role;
+--error ER_PASSWORD_ANONYMOUS_USER
+set default role test_role for ''@localhost;
+
+connection default;
+disconnect con1;
+REVOKE all privileges, grant option from ''@localhost;
+--source include/delete_anonymous_users.inc
+drop role test_role; \ No newline at end of file