Commit 96475b78 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-25457 CREATE / DROP PROCEDURE not logged with audit plugin.

CREATE/DROP PROCEDIRE/FUNCTION is now treated as DDL.
parent 3157fa18
...@@ -140,6 +140,10 @@ select 2; ...@@ -140,6 +140,10 @@ select 2;
2 2
2 2
drop table t1; drop table t1;
create procedure pr1() insert into test.t1 values ("foo", 42);
create function fn1(i int) returns int deterministic return i+1;
drop procedure pr1;
drop function fn1;
set global server_audit_events='query_ddl,query_dml'; set global server_audit_events='query_ddl,query_dml';
create table t1(id int); create table t1(id int);
insert into t1 values (1), (2); insert into t1 values (1), (2);
...@@ -211,6 +215,10 @@ select 2; ...@@ -211,6 +215,10 @@ select 2;
2 2
2 2
drop table t1; drop table t1;
create procedure pr1() insert into test.t1 values ("foo", 42);
create function fn1(i int) returns int deterministic return i+1;
drop procedure pr1;
drop function fn1;
set global server_audit_events='table'; set global server_audit_events='table';
set global server_audit_incl_users='user1'; set global server_audit_incl_users='user1';
create user user1@localhost; create user user1@localhost;
...@@ -394,6 +402,10 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping, ...@@ -394,6 +402,10 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop table t1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create procedure pr1() insert into test.t1 values ("foo", 42)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create function fn1(i int) returns int deterministic return i+1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop procedure pr1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop function fn1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'create table t1(id int)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select * from t1',0
......
...@@ -107,6 +107,12 @@ select 2; ...@@ -107,6 +107,12 @@ select 2;
/*! select 2*/; /*! select 2*/;
/*comment*/ select 2; /*comment*/ select 2;
drop table t1; drop table t1;
create procedure pr1() insert into test.t1 values ("foo", 42);
create function fn1(i int) returns int deterministic return i+1;
drop procedure pr1;
drop function fn1;
set global server_audit_events='query_ddl,query_dml'; set global server_audit_events='query_ddl,query_dml';
create table t1(id int); create table t1(id int);
insert into t1 values (1), (2); insert into t1 values (1), (2);
...@@ -147,6 +153,11 @@ select * from t1; ...@@ -147,6 +153,11 @@ select * from t1;
select 2; select 2;
drop table t1; drop table t1;
create procedure pr1() insert into test.t1 values ("foo", 42);
create function fn1(i int) returns int deterministic return i+1;
drop procedure pr1;
drop function fn1;
set global server_audit_events='table'; set global server_audit_events='table';
set global server_audit_incl_users='user1'; set global server_audit_incl_users='user1';
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#define PLUGIN_VERSION 0x104 #define PLUGIN_VERSION 0x104
#define PLUGIN_STR_VERSION "1.4.11" #define PLUGIN_STR_VERSION "1.4.13"
#define _my_thread_var loc_thread_var #define _my_thread_var loc_thread_var
...@@ -858,12 +858,8 @@ struct sa_keyword keywords_to_skip[]= ...@@ -858,12 +858,8 @@ struct sa_keyword keywords_to_skip[]=
struct sa_keyword not_ddl_keywords[]= struct sa_keyword not_ddl_keywords[]=
{ {
{4, "DROP", &function_word, SQLCOM_QUERY_ADMIN},
{4, "DROP", &procedure_word, SQLCOM_QUERY_ADMIN},
{4, "DROP", &user_word, SQLCOM_DCL}, {4, "DROP", &user_word, SQLCOM_DCL},
{6, "CREATE", &user_word, SQLCOM_DCL}, {6, "CREATE", &user_word, SQLCOM_DCL},
{6, "CREATE", &function_word, SQLCOM_QUERY_ADMIN},
{6, "CREATE", &procedure_word, SQLCOM_QUERY_ADMIN},
{6, "RENAME", &user_word, SQLCOM_DCL}, {6, "RENAME", &user_word, SQLCOM_DCL},
{0, NULL, 0, SQLCOM_DDL} {0, NULL, 0, SQLCOM_DDL}
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment