[Commits] Rev 3861: MDEV-4472 Audit plugin. in file:///home/hf/wmar/mdev-4472/

holyfoot at askmonty.org holyfoot at askmonty.org
Thu Aug 22 23:52:42 EEST 2013


At file:///home/hf/wmar/mdev-4472/

------------------------------------------------------------
revno: 3861
revision-id: holyfoot at askmonty.org-20130822194255-76owptwkf653l8u9
parent: holyfoot at askmonty.org-20130822175731-1vv1j2y5cgy9s6ua
committer: Alexey Botchkov <holyfoot at askmonty.org>
branch nick: mdev-4472
timestamp: Fri 2013-08-23 00:42:55 +0500
message:
  MDEV-4472 Audit plugin.
          additions 1
-------------- next part --------------
=== modified file 'mysql-test/suite/plugins/r/server_audit.result'
--- a/mysql-test/suite/plugins/r/server_audit.result	2013-08-22 17:57:31 +0000
+++ b/mysql-test/suite/plugins/r/server_audit.result	2013-08-22 19:42:55 +0000
@@ -36,6 +36,7 @@ select * from t2;
 id
 1
 2
+alter table t1 rename renamed_t1;
 set global server_audit_events='connect,query';
 insert into t2 values (1), (2);
 select * from t2;
@@ -48,7 +49,7 @@ select * from t_doesnt_exist;
 ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist
 syntax_error_query;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'syntax_error_query' at line 1
-drop table t1, t2;
+drop table renamed_t1, t2;
 show variables like 'server_audit%';
 Variable_name   Value
 server_audit_events     CONNECT,QUERY
@@ -90,12 +91,16 @@ TIME,HOSTNAME,root,localhost,ID,ID,WRITE
 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'insert into t2 values (1), (2)',0
 TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t2,
 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select * from t2',0
+TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
+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,'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
 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'syntax_error_query',ID
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'drop table t1, t2',0
+TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'drop table renamed_t1, t2',0
 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit%\'',0
 TIME,HOSTNAME,root,localhost,ID,0,QUERY,,'set global server_audit_mode=1',0
 TIME,HOSTNAME,root,localhost,ID,0,QUERY,,'set global server_audit_events=\'\'',0

=== modified file 'mysql-test/suite/plugins/t/server_audit.test'
--- a/mysql-test/suite/plugins/t/server_audit.test	2013-08-22 17:57:31 +0000
+++ b/mysql-test/suite/plugins/t/server_audit.test	2013-08-22 19:42:55 +0000
@@ -28,6 +28,7 @@ select * from t1;
 set global server_audit_incl_users='odin, root, dva, tri';
 insert into t2 values (1), (2);
 select * from t2;
+alter table t1 rename renamed_t1;
 set global server_audit_events='connect,query';
 insert into t2 values (1), (2);
 select * from t2;
@@ -35,7 +36,7 @@ select * from t2;
 select * from t_doesnt_exist;
 --error 1064
 syntax_error_query;
-drop table t1, t2;
+drop table renamed_t1, t2;
 show variables like 'server_audit%';
 set global server_audit_mode=1;
 set global server_audit_events='';

=== modified file 'plugin/server_audit/server_audit.c'
--- a/plugin/server_audit/server_audit.c	2013-08-22 17:57:31 +0000
+++ b/plugin/server_audit/server_audit.c	2013-08-22 19:42:55 +0000
@@ -606,7 +606,7 @@ static int log_statement(const struct my
 {
   size_t csize, user_len, host_len, esc_q_len;
   char message[1024];
-  char uh_buffer[512];
+  char uh_buffer[768];
   time_t ev_time= (time_t) event->general_time;
   const char *db= NULL;
   unsigned int db_length;
@@ -715,7 +715,7 @@ static int log_rename(const struct mysql
                     event->host, strlen(event->host),
                     event->thread_id, query_id, "RENAME");
   csize+= my_snprintf(message+csize, sizeof(message) - 1 - csize,
-            ",%.*s,%.*s,%.*s,%.*s",event->database_length, event->database,
+            ",%.*s,%.*s|%.*s.%.*s,",event->database_length, event->database,
                          event->table_length, event->table,
                          event->new_database_length, event->new_database,
                          event->new_table_length, event->new_table);



More information about the commits mailing list