polardbxengine/mysql-test/suite/xengine_audit_null/t/authentication_abort.test

185 lines
10 KiB
Plaintext

#
# Test whether all MYSQL_AUDIT_AUTHENTICATION_XXX events are non abortable.
#
--source include/have_null_audit_plugin.inc
call mtr.add_suppression("Event 'MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE' cannot be aborted.");
call mtr.add_suppression("Event 'MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME' cannot be aborted.");
call mtr.add_suppression("Event 'MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP' cannot be aborted.");
call mtr.add_suppression("Event 'MYSQL_AUDIT_AUTHENTICATION_FLUSH' cannot be aborted.");
call mtr.add_suppression("Abort MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE with my_message.");
call mtr.add_suppression("Abort MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME with my_message.");
call mtr.add_suppression("Abort MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP with my_message.");
call mtr.add_suppression("Abort MYSQL_AUDIT_AUTHENTICATION_FLUSH with my_message.");
--replace_regex /\.dll/.so/
eval INSTALL PLUGIN null_audit SONAME '$AUDIT_NULL';
let $event_order_exact= 1;
let $command_id= 3;
if(`SELECT $PS_PROTOCOL > 0`)
{
let $event_order_exact= 0;
let $command_id= 22;
}
--echo ##############################################
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_CREATE ##
--echo ##############################################
--replace_result $event_order_exact <expected_check_exact>
eval SET @@null_audit_event_order_check_exact = $event_order_exact;
--replace_result $command_id <expected_command_id>
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;'
'MYSQL_AUDIT_PARSE_PREPARSE;;;'
'MYSQL_AUDIT_PARSE_POSTPARSE;;;'
'MYSQL_AUDIT_GENERAL_LOG;;;'
'MYSQL_AUDIT_QUERY_START;sql_command_id="84";;'
'MYSQL_AUDIT_QUERY_STATUS_END;sql_command_id="84";;'
'MYSQL_AUDIT_GENERAL_RESULT;;;'
'MYSQL_AUDIT_GENERAL_STATUS;;;'
'MYSQL_AUDIT_COMMAND_END;command_id="$command_id";';
CREATE USER testuser@localhost IDENTIFIED BY 'testpwd';
SELECT @@null_audit_event_order_check;
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_CREATE - END ##
--echo ##################################################
--echo ## MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE ##
--echo ##################################################
--replace_result $event_order_exact <expected_check_exact>
eval SET @@null_audit_event_order_check_exact = $event_order_exact;
let $quoted_command_id= "$command_id";
--replace_result $quoted_command_id "\"<expected_command_id>\""
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;'
'MYSQL_AUDIT_PARSE_PREPARSE;;;'
'MYSQL_AUDIT_PARSE_POSTPARSE;;;'
'MYSQL_AUDIT_GENERAL_LOG;;;'
'MYSQL_AUDIT_QUERY_START;sql_command_id="134";;'
'MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE;;ABORT_RET';
ALTER USER testuser@localhost IDENTIFIED BY 'NewPass';
SELECT @@null_audit_event_order_check;
--echo ## MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE - END ##
--echo ##############################################
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME ##
--echo ##############################################
--replace_result $event_order_exact <expected_check_exact>
eval SET @@null_audit_event_order_check_exact = $event_order_exact;
--replace_result $command_id <expected_command_id>
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;'
'MYSQL_AUDIT_PARSE_PREPARSE;;;'
'MYSQL_AUDIT_PARSE_POSTPARSE;;;'
'MYSQL_AUDIT_GENERAL_LOG;;;'
'MYSQL_AUDIT_QUERY_START;sql_command_id="86";;'
'MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME;;ABORT_RET';
RENAME USER testuser@localhost TO newuser@localhost;
SELECT @@null_audit_event_order_check;
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME - END ##
--echo ############################################
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP ##
--echo ############################################
--replace_result $event_order_exact <expected_check_exact>
eval SET @@null_audit_event_order_check_exact = $event_order_exact;
--replace_result "$command_id" <expected_command_id>
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;'
'MYSQL_AUDIT_PARSE_PREPARSE;;;'
'MYSQL_AUDIT_PARSE_POSTPARSE;;;'
'MYSQL_AUDIT_GENERAL_LOG;;;'
'MYSQL_AUDIT_QUERY_START;sql_command_id="85";;'
'MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP;;ABORT_RET';
DROP USER newuser@localhost;
SELECT @@null_audit_event_order_check;
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP - END ##
--echo ######################################
--echo ## MYSQL_AUDIT_AUTHENTICATION_FLUSH ##
--echo ######################################
eval SET @@null_audit_event_order_check_exact = 1;
SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="3";;'
'MYSQL_AUDIT_PARSE_PREPARSE;;;'
'MYSQL_AUDIT_PARSE_POSTPARSE;;;'
'MYSQL_AUDIT_GENERAL_LOG;;;'
'MYSQL_AUDIT_QUERY_START;sql_command_id="49";;'
'MYSQL_AUDIT_AUTHENTICATION_FLUSH;;ABORT_RET';
FLUSH PRIVILEGES;
SELECT @@null_audit_event_order_check;
--echo ## MYSQL_AUDIT_AUTHENTICATION_FLUSH - END ##
--echo ##################################################
--echo ## MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE ##
--echo ##################################################
CREATE USER testuser@localhost IDENTIFIED BY 'testpwd';
--replace_result $event_order_exact <expected_check_exact>
eval SET @@null_audit_event_order_check_exact = $event_order_exact;
SET @@null_audit_abort_message = "Abort MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE with my_message.";
let $quoted_command_id= "$command_id";
--replace_result $quoted_command_id "\"<expected_command_id>\""
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;'
'MYSQL_AUDIT_PARSE_PREPARSE;;;'
'MYSQL_AUDIT_PARSE_POSTPARSE;;;'
'MYSQL_AUDIT_GENERAL_LOG;;;'
'MYSQL_AUDIT_QUERY_START;sql_command_id="134";;'
'MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE;;ABORT_RET';
ALTER USER testuser@localhost IDENTIFIED BY 'NewPass';
SELECT @@null_audit_event_order_check;
--echo ## MYSQL_AUDIT_AUTHENTICATION_CREDENTIAL_CHANGE - END ##
--echo ##############################################
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME ##
--echo ##############################################
--replace_result $event_order_exact <expected_check_exact>
eval SET @@null_audit_event_order_check_exact = $event_order_exact;
SET @@null_audit_abort_message = "Abort MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME with my_message.";
--replace_result $command_id <expected_command_id>
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;'
'MYSQL_AUDIT_PARSE_PREPARSE;;;'
'MYSQL_AUDIT_PARSE_POSTPARSE;;;'
'MYSQL_AUDIT_GENERAL_LOG;;;'
'MYSQL_AUDIT_QUERY_START;sql_command_id="86";;'
'MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME;;ABORT_RET';
RENAME USER testuser@localhost TO newuser@localhost;
SELECT @@null_audit_event_order_check;
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_RENAME - END ##
--echo ############################################
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP ##
--echo ############################################
--replace_result $event_order_exact <expected_check_exact>
eval SET @@null_audit_event_order_check_exact = $event_order_exact;
SET @@null_audit_abort_message = "Abort MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP with my_message.";
--replace_result "$command_id" <expected_command_id>
eval SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="$command_id";;'
'MYSQL_AUDIT_PARSE_PREPARSE;;;'
'MYSQL_AUDIT_PARSE_POSTPARSE;;;'
'MYSQL_AUDIT_GENERAL_LOG;;;'
'MYSQL_AUDIT_QUERY_START;sql_command_id="85";;'
'MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP;;ABORT_RET';
DROP USER newuser@localhost;
SELECT @@null_audit_event_order_check;
--echo ## MYSQL_AUDIT_AUTHENTICATION_AUTHID_DROP - END ##
--echo ######################################
--echo ## MYSQL_AUDIT_AUTHENTICATION_FLUSH ##
--echo ######################################
eval SET @@null_audit_event_order_check_exact = 1;
SET @@null_audit_abort_message = "Abort MYSQL_AUDIT_AUTHENTICATION_FLUSH with my_message.";
SET @@null_audit_event_order_check = 'MYSQL_AUDIT_COMMAND_START;command_id="3";;'
'MYSQL_AUDIT_PARSE_PREPARSE;;;'
'MYSQL_AUDIT_PARSE_POSTPARSE;;;'
'MYSQL_AUDIT_GENERAL_LOG;;;'
'MYSQL_AUDIT_QUERY_START;sql_command_id="49";;'
'MYSQL_AUDIT_AUTHENTICATION_FLUSH;;ABORT_RET';
FLUSH PRIVILEGES;
SELECT @@null_audit_event_order_check;
--echo ## MYSQL_AUDIT_AUTHENTICATION_FLUSH - END ##
UNINSTALL PLUGIN null_audit;