mariadb/mysql-test/t/old_passwords_func.test

120 lines
4.1 KiB
Text

############# mysql-test\t\old_passwords_func.test ############################
# #
# Variable Name: old_passwords #
# Scope: GLOBAL & SESSION #
# Access Type: Dynamic #
# Data Type: BOOLEAN #
# Default Value: FALSE #
# Values: TRUE, FALSE #
# #
# #
# Creation Date: 2008-03-12 #
# Author: Sharique Abdullah #
# #
# Description: Test Cases of Dynamic System Variable "old_passwords" #
# that checks behavior of this variable in the following ways #
# * Functionality based on different values #
# #
# Reference: http://dev.mysql.com/doc/refman/5.0/en #
# /server-options.html#option_mysqld_old-passwords #
# #
###############################################################################
#
# Setup
#
--source include/not_embedded.inc
SET @global_old_passwords = @@GLOBAL.old_passwords;
SET @session_old_passwords = @@SESSION.old_passwords;
SET @global_secure_auth = @@GLOBAL.secure_auth;
--echo '#------------------------FN_DYNVARS_115_01---------------------------#'
--echo ** Connection default **
connection default;
#
# 2 Users with FALSE value
#
CREATE USER 'userNewPass1'@'localhost' IDENTIFIED BY 'pass1';
CREATE USER 'userNewPass2'@'localhost' IDENTIFIED BY 'pass2';
SET GLOBAL old_passwords = TRUE;
SET SESSION old_passwords = TRUE;
#
# 1 User with TRUE value
#
CREATE USER 'userOldPass'@'localhost' IDENTIFIED BY 'pass3';
SET GLOBAL secure_auth = FALSE;
--echo ** Connecting con1 using username 'userNewPass1' **
connect (con1,localhost,userNewPass1,pass1,);
SELECT CURRENT_USER();
--echo userNewPass1@localhost Expected
--echo ** Connecting con2 using username 'userNewPass2' **
connect (con2,localhost,userNewPass2,pass2,);
SELECT CURRENT_USER();
--echo userNewPass2@localhost Expected
--echo ** Connecting con3 using username 'userOldPass' **
connect (con3,localhost,userOldPass,pass3,);
SELECT CURRENT_USER();
--echo userOldPass@localhost Expected
--echo ** Connection default **
connection default;
--echo ** Disconnecting con1, con2, con3 **
disconnect con1;
disconnect con2;
disconnect con3;
--echo '#------------------------FN_DYNVARS_115_02---------------------------#'
SET GLOBAL secure_auth = TRUE;
--echo ** Connecting con1 using username 'userNewPass1' **
connect (con1,localhost,userNewPass1,pass1,);
SELECT CURRENT_USER();
--echo userNewPass1@localhost Expected
--echo ** Connecting con2 using username 'userNewPass2' **
connect (con2,localhost,userNewPass2,pass2,);
SELECT CURRENT_USER();
--echo userNewPass2@localhost Expected
--echo ** Connecting con3 using username 'userOldPass' **
--disable_query_log
--error ER_SERVER_IS_IN_SECURE_AUTH_MODE
connect (con3,localhost,userOldPass,pass3,);
--enable_query_log
--echo Expected Error 'Server is running in secure auth mode'
SELECT CURRENT_USER();
--echo userNewPass2@localhost Expected
--echo ** Connection default **
connection default;
--echo ** Disconnecting con1, con2 **
disconnect con1;
disconnect con2;
#
# Cleanup
#
DROP USER 'userNewPass1'@'localhost';
DROP USER 'userNewPass2'@'localhost';
DROP USER 'userOldPass'@'localhost';
SET @@GLOBAL.old_passwords = @global_old_passwords;
SET @@SESSION.old_passwords = @session_old_passwords;
SET @@GLOBAL.secure_auth = @global_secure_auth;