1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
call mtr.add_suppression("Event 'MYSQL_AUDIT_GENERAL_ERROR' cannot be aborted.");
#
# Bug #22142209: MY_MESSAGE FAILS TO ABORT MYSQL_AUDIT_SERVER_STARTUP_CLASS EVENT
#
# Shutdown the server
# Load the plugin at startup and abort on STARTUP with default message
# Search for default abort message
Pattern "\[ERROR\] \[[^]]*\] \[[^]]*\] Aborted by Audit API \(\'MYSQL_AUDIT_SERVER_STARTUP_STARTUP\'.1\)\." found
# Load the plugin at startup and abort on STARTUP event with custom message
# Search for custom abort message
Pattern "\[ERROR\] \[[^]]*\] \[[^]]*\] Abort message custom" found
# Startup the server
#
# Bug #22136709: INFINITE RECURSION BY CALLING MY_MESSAGE FROM
# MYSQL_AUDIT_GENERAL_CLASS HANDLER
INSTALL PLUGIN null_audit SONAME 'adt_null.so';
SET @@GLOBAL.null_audit_event_order_check= "MYSQL_AUDIT_GENERAL_ERROR;;ABORT_RET";
SET @@GLOBAL.null_audit_abort_message= "Abort message.";
# Try to enter error state recursively 2 times.
SET @@GLOBAL.null_audit_event_order_check_consume_ignore_count= 2;
connect(localhost,wrong_root,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'wrong_root'@'localhost' (using password: NO)
SELECT @@null_audit_event_order_check_consume_ignore_count;
@@null_audit_event_order_check_consume_ignore_count
0
# Try to enter error state infinitely. my_message calls cause stack overrun.
SET @@GLOBAL.null_audit_event_order_check_consume_ignore_count= 10000;
connect(localhost,wrong_root,,test,MASTER_PORT,MASTER_SOCKET);
SELECT @@null_audit_event_order_check_consume_ignore_count;
@@null_audit_event_order_check_consume_ignore_count
0
SET @@GLOBAL.null_audit_event_order_check= NULL;
SET @@GLOBAL.null_audit_abort_message= NULL;
SET @@GLOBAL.null_audit_event_order_check_consume_ignore_count= 0;
End of 5.7 tests
#
# Bug#24961932 - create function at bootstrap attempts to evaluate
# non-resolved expressions
#
# Initial value of the status variable "Audit_null_global_variable_get".
SELECT variable_value FROM performance_schema.global_status
WHERE variable_name = 'Audit_null_global_variable_get'
INTO @initial_global_var_get_count;
CREATE PROCEDURE check_global_var_count()
BEGIN
SELECT variable_value FROM performance_schema.global_status
WHERE variable_name = 'Audit_null_global_variable_get'
INTO @cur_global_var_get_count;
SELECT @cur_global_var_get_count - @initial_global_var_get_count AS
global_var_count;
END
$
# Procedure p1 using global system variables.
CREATE PROCEDURE p1()
BEGIN
SET @a=@@global.max_execution_time;
CREATE TABLE t1 AS SELECT @@global.max_execution_time;
DROP TABLE t1;
SELECT @@global.optimizer_trace, @@session.max_execution_time;
END
$
# Without fix, non-resolved expression is evaluated to audit the global
# system variable get event while creating the stored routines.
# The audit for the system variable get event should be done while
# executing the stored routine but not while creating it. With the fix,
# global system variable get event is audited while executing the stored
# routine. At this time, expression is resolved. Hence status variable
# "Audit_null_global_variable_get" remains unchanged while creating the
# stored routine.
CALL check_global_var_count();
global_var_count
0
# The same issue exits with the prepared statement too. With the fix,
# system variable get event is not audited while preparing the statement.
# Instead it is done while executing the statement. Hence status variable
# "Audit_null_global_variable_get" remains same here too.
PREPARE stmt FROM 'SELECT @@global.max_execution_time,@@global.optimizer_trace';
CALL check_global_var_count();
global_var_count
0
# With the fix, system variable get event is audited on each execution of
# the routine. Hence status variable "Audit_null_global_variable_get" is
# incremented by value three by p1() here.
CALL p1();
@@global.optimizer_trace @@session.max_execution_time
enabled=off,one_line=off 0
CALL check_global_var_count();
global_var_count
3
# With the fix, system variable get event is audited on each execution of
# the routine. Hence status variable "Audit_null_global_variable_get" is
# incremented by value three by p1() here.
CALL p1();
@@global.optimizer_trace @@session.max_execution_time
enabled=off,one_line=off 0
CALL check_global_var_count();
global_var_count
6
# System variable get event is audited for global variables only. Hence
# status variable "Audit_null_global_variable_get" remain same here.
SELECT @@session.max_execution_time, @@session.optimizer_trace;
@@session.max_execution_time @@session.optimizer_trace
0 enabled=off,one_line=off
CALL check_global_var_count();
global_var_count
6
# With the fix, system variable get event is audited on each execution of
# the prepared statement. Hence status "Audit_null_global_variable_get"
# variable is incremented by value two here.
EXECUTE stmt;
@@global.max_execution_time @@global.optimizer_trace
0 enabled=off,one_line=off
CALL check_global_var_count();
global_var_count
8
# With the fix, system variable get event is audited on each execution of
# the prepared statement. Hence status "Audit_null_global_variable_get"
# variable is incremented by value two here.
EXECUTE stmt;
@@global.max_execution_time @@global.optimizer_trace
0 enabled=off,one_line=off
CALL check_global_var_count();
global_var_count
10
# Verify if system variable get event is audited in the simple select.
# Status variable "Audit_null_global_variable_get" is incremented by
# value two here.
SELECT @@global.max_execution_time, @@global.optimizer_trace;
@@global.max_execution_time @@global.optimizer_trace
0 enabled=off,one_line=off
CALL check_global_var_count();
global_var_count
12
DROP PROCEDURE p1;
DROP PROCEDURE check_global_var_count;
DROP PREPARE stmt;
#
# Bug#27638290 - Set @@null_audit_event_record_def =
# 'mysql_audit_authentication_flush'; crashed
#
# New connection, unbound thread
# Expect NULL
SELECT @@null_audit_event_record_def;
@@null_audit_event_record_def
NULL
# Invalid data
SET @@null_audit_event_record_def = 'ABSOLUTE_NONSENSE';
SELECT 1;
1
1
# Expect NULL
SELECT @@null_audit_event_record;
@@null_audit_event_record
NULL
SELECT @@null_audit_event_record_def;
@@null_audit_event_record_def
ABSOLUTE_NONSENSE
# Invalid data again
SET @@null_audit_event_record_def = 'MYSQL_AUDIT_AUTHENTICATION_FLUSH;JUNK';
SELECT 1;
1
1
# Expect NULL
SELECT @@null_audit_event_record;
@@null_audit_event_record
NULL
SELECT @@null_audit_event_record_def;
@@null_audit_event_record_def
MYSQL_AUDIT_AUTHENTICATION_FLUSH;JUNK
# Valid data
SET @@null_audit_event_record_def = 'MYSQL_AUDIT_GENERAL_RESULT;MYSQL_AUDIT_COMMAND_END';
SELECT 1;
1
1
SELECT @@null_audit_event_record;
@@null_audit_event_record
MYSQL_AUDIT_GENERAL_RESULT;;
MYSQL_AUDIT_GENERAL_STATUS;;
MYSQL_AUDIT_COMMAND_END;command_id="<expected_command_id>";
End of 8.0 tests
# cleanup
UNINSTALL PLUGIN null_audit;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|