summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2021-09-07 09:24:43 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2021-09-07 09:24:43 +0200
commitde92e37344d0dc0b4044ce95e9da07bc129eaa8e (patch)
tree15166c2a38a6e6bf9f91755d47041c39219433be
parentee9765b58cbc6fd701fe26d65e0917b5f0ff2d58 (diff)
downloadmariadb-git-bb-10.7-MDEV-9245-3.tar.gz
-rw-r--r--mysql-test/suite/plugins/t/reuse_password_check.test46
1 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/suite/plugins/t/reuse_password_check.test b/mysql-test/suite/plugins/t/reuse_password_check.test
new file mode 100644
index 00000000000..b43d17d43bd
--- /dev/null
+++ b/mysql-test/suite/plugins/t/reuse_password_check.test
@@ -0,0 +1,46 @@
+--source include/not_embedded.inc
+
+if (!$REUSE_PASSWORD_CHECK_SO) {
+ skip No REUSE_PASSWORD_CHECK plugin;
+}
+
+install soname "reuse_password_check";
+
+--echo # Default value (sould be unlimited i.e. 0)
+SHOW GLOBAL VARIABLES like "reuse_password_check%";
+
+--echo # insert user
+grant select on *.* to user_name@localhost identified by 'test_pwd';
+
+#--error ER_NOT_VALID_PASSWORD
+#grant select on *.* to user_name@localhost identified by 'test_pwd';
+#show warnings;
+
+--error ER_CANNOT_USER
+alter user user_name@localhost identified by 'test_pwd';
+show warnings;
+
+# Plugin does not work for it
+#--error ER_NOT_VALID_PASSWORD
+#SET PASSWORD FOR user_name@localhost = PASSWORD('test_pwd');
+
+--echo # emulate old password
+
+update mysql.reuse_password_check_history set time= date_sub(now(), interval
+11 day);
+
+set global reuse_password_check_interval= 10;
+
+--error ER_CANNOT_USER
+alter user user_name@localhost identified by 'test_pwd';
+show warnings;
+
+drop user user_name@localhost;
+
+show create table mysql.reuse_password_check_history;
+select hex(hash), time from mysql.reuse_password_check_history;
+select count(*) from mysql.reuse_password_check_history;
+
+drop table mysql.reuse_password_check_history;
+
+uninstall plugin reuse_password_check;