offset support for 5.5.40 and 5.6.21. Better auto offset detection for debina/ubuntu using 5.6.x. Compilation support with MariaDB 10 source code.

This commit is contained in:
Guy Lichtman
2014-10-06 09:29:35 +02:00
parent 23fb7f63c9
commit caf75d3c46
7 changed files with 834 additions and 776 deletions

View File

@@ -10,7 +10,11 @@
#include "mysql_inc.h"
#include <yajl/yajl_gen.h>
#ifndef PCRE_STATIC
#define PCRE_STATIC
#endif
#include <pcre.h>
#define AUDIT_LOG_PREFIX "Audit Plugin:"
@@ -63,6 +67,12 @@ typedef struct ThdOffsets
OFFSET sec_ctx_priv_user;
} ThdOffsets;
/*
* The offsets array
*/
extern const ThdOffsets thd_offsets_arr[];
extern const size_t thd_offsets_arr_size;
/*
* On success, the number of bytes written are returned (zero indicates nothing was written). On error, -1 is returned,
*/
@@ -192,7 +202,7 @@ public:
{
//interface changed in 5.5.34 and 5.6.14 and up host changed to get_host()
//see: http://bazaar.launchpad.net/~mysql/mysql-server/5.5/revision/4407.1.1/sql/sql_class.h
#if ( !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50534 && MYSQL_VERSION_ID < 50600) || (MYSQL_VERSION_ID >= 50614)
#if !defined(MARIADB_BASE_VERSION) && ( ( MYSQL_VERSION_ID >= 50534 && MYSQL_VERSION_ID < 50600) || (MYSQL_VERSION_ID >= 50614) )
return sctx->get_host()->ptr();
#else
return sctx->host;
@@ -208,7 +218,7 @@ public:
if(!Audit_formatter::thd_offsets.sec_ctx_ip) //no offsets use compiled in header
{
//interface changed in 5.5.34 and 5.6.14 and up host changed to get_ip()
#if ( !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50534 && MYSQL_VERSION_ID < 50600) || (MYSQL_VERSION_ID >= 50614)
#if !defined(MARIADB_BASE_VERSION) && ( (MYSQL_VERSION_ID >= 50534 && MYSQL_VERSION_ID < 50600) || (MYSQL_VERSION_ID >= 50614) )
return sctx->get_ip()->ptr();
#else
return sctx->ip;