Commit db0ecf26 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-8032 [PATCH] audit plugin - csv output broken.

   Symbols like TAB or NEWLINE should be escaped, which was
        forgotten in one place.
parent 6264451f
...@@ -45,6 +45,11 @@ id ...@@ -45,6 +45,11 @@ id
2 2
alter table t1 rename renamed_t1; alter table t1 rename renamed_t1;
set global server_audit_events='connect,query'; set global server_audit_events='connect,query';
select 1,
2,
3;
1 2 3
1 2 3
insert into t2 values (1), (2); insert into t2 values (1), (2);
select * from t2; select * from t2;
id id
...@@ -244,6 +249,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,ALTER,test,t1, ...@@ -244,6 +249,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,ALTER,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1, TIME,HOSTNAME,root,localhost,ID,ID,RENAME,test,t1|test.renamed_t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'alter table t1 rename renamed_t1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_events=\'connect,query\'',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select 1, 2, 3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID
......
...@@ -35,6 +35,9 @@ insert into t2 values (1), (2); ...@@ -35,6 +35,9 @@ insert into t2 values (1), (2);
select * from t2; select * from t2;
alter table t1 rename renamed_t1; alter table t1 rename renamed_t1;
set global server_audit_events='connect,query'; set global server_audit_events='connect,query';
select 1,
2,
3;
insert into t2 values (1), (2); insert into t2 values (1), (2);
select * from t2; select * from t2;
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
......
...@@ -1118,6 +1118,8 @@ static size_t escape_string(const char *str, unsigned int len, ...@@ -1118,6 +1118,8 @@ static size_t escape_string(const char *str, unsigned int len,
*(result++)= '\\'; *(result++)= '\\';
*(result++)= '\\'; *(result++)= '\\';
} }
else if (is_space(*str))
*(result++)= ' ';
else else
*(result++)= *str; *(result++)= *str;
str++; str++;
......
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