Skip to content

Commit

Permalink
MDEV-8032 [PATCH] audit plugin - csv output broken.
Browse files Browse the repository at this point in the history
   Symbols like TAB or NEWLINE should be escaped, which was
        forgotten in one place.
  • Loading branch information
Alexey Botchkov committed Jun 6, 2015
1 parent 6264451 commit db0ecf2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mysql-test/suite/plugins/r/server_audit.result
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ id
2
alter table t1 rename renamed_t1;
set global server_audit_events='connect,query';
select 1,
2,
3;
1 2 3
1 2 3
insert into t2 values (1), (2);
select * from t2;
id
Expand Down Expand Up @@ -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,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,'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,'select * from t2',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t_doesnt_exist',ID
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/plugins/t/server_audit.test
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ insert into t2 values (1), (2);
select * from t2;
alter table t1 rename renamed_t1;
set global server_audit_events='connect,query';
select 1,
2,
3;
insert into t2 values (1), (2);
select * from t2;
--error ER_NO_SUCH_TABLE
Expand Down
2 changes: 2 additions & 0 deletions plugin/server_audit/server_audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,8 @@ static size_t escape_string(const char *str, unsigned int len,
*(result++)= '\\';
*(result++)= '\\';
}
else if (is_space(*str))
*(result++)= ' ';
else
*(result++)= *str;
str++;
Expand Down

0 comments on commit db0ecf2

Please sign in to comment.