1--source include/not_embedded.inc 2 3# setup some user accounts 4 5CREATE USER 'user1'@'127.0.0.1' IDENTIFIED BY 'password1'; 6CREATE USER 'user22'@'%' IDENTIFIED BY 'password1'; 7CREATE USER '22user'@'LOCALHOST' IDENTIFIED BY 'password1'; 8CREATE USER 'admin'@'%' IDENTIFIED BY 'password1'; 9CREATE USER 'us,er1'@'localhost' IDENTIFIED BY 'password1'; 10 11# test set/unset filters 12 13SET GLOBAL audit_log_include_accounts= 'user1@localhost,, user22@127.0.0.1,admin@%'; 14SELECT @@audit_log_include_accounts, @@audit_log_exclude_accounts; 15--error ER_WRONG_VALUE_FOR_VAR 16SET GLOBAL audit_log_exclude_accounts= '22useer@localhost'; 17--error ER_WRONG_VALUE_FOR_VAR 18SET GLOBAL audit_log_exclude_accounts= NULL; 19SELECT @@audit_log_include_accounts, @@audit_log_exclude_accounts; 20SET GLOBAL audit_log_include_accounts= 'user1@localhost, user2@localhost, user3@localhost'; 21SELECT @@audit_log_include_accounts, @@audit_log_exclude_accounts; 22SET GLOBAL audit_log_include_accounts= ''; 23SELECT @@audit_log_include_accounts, @@audit_log_exclude_accounts; 24--error ER_WRONG_VALUE_FOR_VAR 25SET GLOBAL audit_log_exclude_accounts= '22useer@localhost'; 26SET GLOBAL audit_log_include_accounts= NULL; 27SELECT @@audit_log_include_accounts, @@audit_log_exclude_accounts; 28 29SET GLOBAL audit_log_exclude_accounts= "'us,er1'@'localhost',, user22@127.0.0.1,admin@%"; 30SELECT @@audit_log_include_accounts, @@audit_log_exclude_accounts; 31--error ER_WRONG_VALUE_FOR_VAR 32SET GLOBAL audit_log_include_accounts= '22useer@localhost'; 33--error ER_WRONG_VALUE_FOR_VAR 34SET GLOBAL audit_log_include_accounts= NULL; 35SELECT @@audit_log_include_accounts, @@audit_log_exclude_accounts; 36SET GLOBAL audit_log_exclude_accounts= 'user1@localhost, user2@localhost, user3@localhost'; 37SELECT @@audit_log_include_accounts, @@audit_log_exclude_accounts; 38SET GLOBAL audit_log_exclude_accounts= ''; 39SELECT @@audit_log_include_accounts, @@audit_log_exclude_accounts; 40--error ER_WRONG_VALUE_FOR_VAR 41SET GLOBAL audit_log_include_accounts= '22useer@localhost'; 42SET GLOBAL audit_log_exclude_accounts= NULL; 43SELECT @@audit_log_include_accounts, @@audit_log_exclude_accounts; 44 45let $MYSQLD_DATADIR= `select @@datadir`; 46let $log_file=$MYSQLD_DATADIR/test_audit.log; 47 48SET GLOBAL audit_log_flush=ON; 49--remove_file $log_file 50SET GLOBAL audit_log_flush=ON; 51 52# log nothing 53SET GLOBAL audit_log_include_accounts= ''; 54 55--source audit_log_filter_events.inc 56 57# testing include 58SET GLOBAL audit_log_include_accounts= 'user1@localhost,, user22@127.0.0.1,admin@%,veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryloooooooooooooongusername@veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryloooooooooooooonghostname'; 59 60--source audit_log_filter_events.inc 61 62# log everything 63SET GLOBAL audit_log_include_accounts= NULL; 64 65--source audit_log_filter_events.inc 66 67# testing exclude 68SET GLOBAL audit_log_exclude_accounts= 'user1@localhost,, user22@127.0.0.1,admin@%'; 69 70--source audit_log_filter_events.inc 71 72SET GLOBAL audit_log_exclude_accounts= NULL; 73 74# testing case sensitivity 75SET GLOBAL audit_log_include_accounts= '22user@LocalHost,User22@%'; 76 77--source audit_log_filter_events.inc 78 79SET GLOBAL audit_log_include_accounts= NULL; 80 81--source audit_log_echo.inc 82 83# cleanup users 84DROP USER 'user1'@'127.0.0.1'; 85DROP USER 'user22'@'%'; 86DROP USER '22user'@'localhost'; 87DROP USER 'admin'@'%'; 88DROP USER 'us,er1'@'localhost'; 89