reindented source files
parent
eb3e38116c
commit
60f1b8e6d7
|
@ -29,8 +29,8 @@
|
|||
* Will write into buff the date prefix for txt formatter. Return the number of bytes written
|
||||
* (not including null terminate).
|
||||
*/
|
||||
static int log_date_prefix(char * buff, size_t buff_size)
|
||||
{
|
||||
static int log_date_prefix(char * buff, size_t buff_size)
|
||||
{
|
||||
struct tm tm_tmp;
|
||||
time_t result= time(NULL);
|
||||
localtime_r(&result, &tm_tmp);
|
||||
|
@ -42,10 +42,10 @@ static int log_date_prefix(char * buff, size_t buff_size)
|
|||
tm_tmp.tm_hour,
|
||||
tm_tmp.tm_min,
|
||||
tm_tmp.tm_sec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//utility macro to log also with a date as a prefix
|
||||
//utility macro to log also with a date as a prefix
|
||||
#define log_with_date(f, ...) do{\
|
||||
struct tm tm_tmp;\
|
||||
time_t result= time(NULL);\
|
||||
|
@ -58,29 +58,29 @@ static int log_date_prefix(char * buff, size_t buff_size)
|
|||
tm_tmp.tm_min,\
|
||||
tm_tmp.tm_sec);\
|
||||
fprintf(f, __VA_ARGS__);\
|
||||
}while(0)
|
||||
}while(0)
|
||||
|
||||
|
||||
//initialize static stuff
|
||||
ThdOffsets Audit_formatter::thd_offsets = { 0 };
|
||||
Audit_handler * Audit_handler::m_audit_handler_list[Audit_handler::MAX_AUDIT_HANDLERS_NUM];
|
||||
const char * Audit_json_formatter::DEF_MSG_DELIMITER = "\\n";
|
||||
//initialize static stuff
|
||||
ThdOffsets Audit_formatter::thd_offsets = { 0 };
|
||||
Audit_handler * Audit_handler::m_audit_handler_list[Audit_handler::MAX_AUDIT_HANDLERS_NUM];
|
||||
const char * Audit_json_formatter::DEF_MSG_DELIMITER = "\\n";
|
||||
|
||||
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
|
||||
|
||||
|
||||
const char * Audit_formatter::retrive_object_type (TABLE_LIST *pObj)
|
||||
{
|
||||
const char * Audit_formatter::retrive_object_type (TABLE_LIST *pObj)
|
||||
{
|
||||
if (pObj->view)
|
||||
{
|
||||
return "VIEW";
|
||||
}
|
||||
return "TABLE";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Audit_handler::stop_all()
|
||||
{
|
||||
void Audit_handler::stop_all()
|
||||
{
|
||||
for (int i = 0; i < MAX_AUDIT_HANDLERS_NUM; ++i)
|
||||
{
|
||||
if (m_audit_handler_list[i] != NULL)
|
||||
|
@ -88,10 +88,10 @@ void Audit_handler::stop_all()
|
|||
m_audit_handler_list[i]->set_enable(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Audit_handler::log_audit_all(ThdSesData *pThdData)
|
||||
{
|
||||
void Audit_handler::log_audit_all(ThdSesData *pThdData)
|
||||
{
|
||||
for (int i = 0; i < MAX_AUDIT_HANDLERS_NUM; ++i)
|
||||
{
|
||||
if (m_audit_handler_list[i] != NULL)
|
||||
|
@ -99,10 +99,10 @@ void Audit_handler::log_audit_all(ThdSesData *pThdData)
|
|||
m_audit_handler_list[i]->log_audit(pThdData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Audit_handler::set_enable(bool val)
|
||||
{
|
||||
void Audit_handler::set_enable(bool val)
|
||||
{
|
||||
lock_exclusive();
|
||||
if (m_enabled == val) //we are already enabled simply return
|
||||
{
|
||||
|
@ -121,10 +121,10 @@ void Audit_handler::set_enable(bool val)
|
|||
handler_stop();
|
||||
}
|
||||
unlock();
|
||||
}
|
||||
}
|
||||
|
||||
void Audit_handler::log_audit(ThdSesData *pThdData)
|
||||
{
|
||||
void Audit_handler::log_audit(ThdSesData *pThdData)
|
||||
{
|
||||
lock_shared();
|
||||
if (!m_enabled)
|
||||
{
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#if !defined(__attribute__) && !defined(__GNUC__)
|
||||
#define __attribute__(A)
|
||||
#endif
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
|||
#ifdef __x86_64__
|
||||
//64 bit offsets
|
||||
static const ThdOffsets thd_offsets_arr[] =
|
||||
{
|
||||
{
|
||||
//DISTRIBUTION: rpm
|
||||
//offsets for: mysqlrpm/5.1.30/usr/sbin/mysqld (5.1.30-community)
|
||||
{"5.1.30-community","8e43bda3644a883d46a1d064304b4f1d", 6184, 6248, 3656, 3928, 88, 2048},
|
||||
|
@ -233,12 +233,12 @@ static const ThdOffsets thd_offsets_arr[] =
|
|||
//offsets for: mysql/5.5.21/bin/mysqld (5.5.21)
|
||||
{"5.5.21","66d23cb577e2bcfe29da08833f5e7d8b", 6048, 6096, 3800, 4224, 88, 2560}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
#else
|
||||
//32 bit offsets
|
||||
static const ThdOffsets thd_offsets_arr[] =
|
||||
{
|
||||
{
|
||||
//DISTRIBUTION: rpm
|
||||
//offsets for: mysqlrpm/5.1.30/usr/sbin/mysqld (5.1.30-community)
|
||||
{"5.1.30-community","fdfe108d05c262c185a7c28b2e493c10", 4024, 4064, 2224, 2404, 44, 1180},
|
||||
|
@ -433,7 +433,7 @@ static const ThdOffsets thd_offsets_arr[] =
|
|||
{"5.5.20","cb9b6887ea525fe9965121d357163fe4", 3808, 3836, 2360, 2692, 44, 1640},
|
||||
//offsets for: mysql/5.5.21/bin/mysqld (5.5.21)
|
||||
{"5.5.21","a0762cee3ad5d4e77480956144900213", 3808, 3836, 2360, 2692, 44, 1640}
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -470,7 +470,7 @@ static unsigned int trampoline_mysql_execute_size =0;
|
|||
static void trampoline_log_slow_statement(THD *thd)
|
||||
{
|
||||
TRAMPOLINE_NOP_DEF
|
||||
}
|
||||
}
|
||||
static unsigned int trampoline_log_slow_statement_size =0;
|
||||
|
||||
static int trampoline_check_user(THD *thd, enum enum_server_command command, const char *passwd, uint passwd_len, const char *db, bool check_count)
|
||||
|
@ -488,13 +488,13 @@ static unsigned int trampoline_acl_authenticate_size =0;
|
|||
|
||||
static MYSQL_THDVAR_ULONG(is_thd_printed_list,
|
||||
PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT, "avoid duplicate printing",
|
||||
NULL, NULL,0,0,
|
||||
NULL, NULL,0,0,
|
||||
#ifdef __x86_64__
|
||||
0xffffffffffffff,
|
||||
0xffffffffffffff,
|
||||
#else
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
#endif
|
||||
1);
|
||||
1);
|
||||
THDPRINTED * GetThdPrintedList (THD *thd)
|
||||
{
|
||||
THDPRINTED * pThdPrintedList= (THDPRINTED*)THDVAR(thd,is_thd_printed_list);
|
||||
|
@ -504,7 +504,7 @@ THDPRINTED * GetThdPrintedList (THD *thd)
|
|||
}
|
||||
THDVAR(thd,is_thd_printed_list) =0;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void audit(ThdSesData *pThdData)
|
||||
{
|
||||
|
@ -573,17 +573,17 @@ static int trampoline_open_tables(THD *thd, TABLE_LIST **start, uint *counter, u
|
|||
|
||||
static MYSQL_THDVAR_ULONG(query_cache_table_list,
|
||||
PLUGIN_VAR_READONLY | PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT, "Pointer to query cache table list.",
|
||||
NULL, NULL,0,0,
|
||||
NULL, NULL,0,0,
|
||||
#ifdef __x86_64__
|
||||
0xffffffffffffff,
|
||||
0xffffffffffffff,
|
||||
#else
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
#endif
|
||||
1);
|
||||
1);
|
||||
|
||||
|
||||
|
||||
QueryTableInf * Audit_formatter::getQueryCacheTableList1 (THD *thd)
|
||||
QueryTableInf * Audit_formatter::getQueryCacheTableList1 (THD *thd)
|
||||
{
|
||||
|
||||
return (QueryTableInf*) THDVAR(thd, query_cache_table_list);
|
||||
|
@ -683,14 +683,14 @@ static void audit_notify(THD *thd , const struct mysql_event * event)
|
|||
|
||||
/*
|
||||
Plugin descriptor
|
||||
*/
|
||||
*/
|
||||
//in 5.5 we use the AUDIT plugin interface. In 5.1 we just use the general DAEMON plugin
|
||||
|
||||
|
||||
|
||||
static int plugin_type = MYSQL_DAEMON_PLUGIN;
|
||||
static struct st_mysql_daemon audit_plugin =
|
||||
{ MYSQL_DAEMON_INTERFACE_VERSION };
|
||||
{ MYSQL_DAEMON_INTERFACE_VERSION };
|
||||
|
||||
|
||||
|
||||
|
@ -753,7 +753,7 @@ void remove_hot_functions ()
|
|||
}
|
||||
|
||||
int is_remove_patches (ThdSesData *pThdData)
|
||||
{
|
||||
{
|
||||
|
||||
|
||||
const char *cmd = pThdData->getCmdName();
|
||||
|
@ -1118,7 +1118,7 @@ const char * retrieve_command (THD * thd)
|
|||
cmd = "Failed Login";
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
|
||||
static int set_com_status_vars_array ()
|
||||
{
|
||||
|
@ -1170,7 +1170,7 @@ static int set_com_status_vars_array ()
|
|||
RETURN VALUE
|
||||
0 success
|
||||
1 failure
|
||||
*/
|
||||
*/
|
||||
|
||||
static int audit_plugin_init(void *p)
|
||||
{
|
||||
|
@ -1366,7 +1366,7 @@ static int audit_plugin_init(void *p)
|
|||
0 success
|
||||
1 failure (cannot happen)
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
static int audit_plugin_deinit(void *p)
|
||||
{
|
||||
|
@ -1378,17 +1378,17 @@ static int audit_plugin_deinit(void *p)
|
|||
|
||||
/*
|
||||
Plugin status variables for SHOW STATUS
|
||||
*/
|
||||
*/
|
||||
|
||||
static struct st_mysql_show_var audit_status[] =
|
||||
{
|
||||
{ "AUDIT_version",
|
||||
{
|
||||
{ "AUDIT_version",
|
||||
(char *) MYSQL_AUDIT_PLUGIN_VERSION "-" MYSQL_AUDIT_PLUGIN_REVISION,
|
||||
SHOW_CHAR },
|
||||
{ "AUDIT_protocol_version",
|
||||
{ "AUDIT_protocol_version",
|
||||
(char *) "1.0",
|
||||
SHOW_CHAR },
|
||||
//{"called", (char *)&number_of_calls, SHOW_LONG},
|
||||
//{"called", (char *)&number_of_calls, SHOW_LONG},
|
||||
{ 0, 0, (enum_mysql_show_type) 0 } };
|
||||
|
||||
|
||||
|
@ -1521,7 +1521,7 @@ static MYSQL_SYSVAR_STR(delay_cmds, delay_cmds_string,
|
|||
* Plugin system vars
|
||||
*/
|
||||
static struct st_mysql_sys_var* audit_system_variables[] =
|
||||
{
|
||||
{
|
||||
MYSQL_SYSVAR(json_log_file),
|
||||
MYSQL_SYSVAR(json_file_sync),
|
||||
MYSQL_SYSVAR(json_file),
|
||||
|
@ -1551,7 +1551,7 @@ mysql_declare_plugin(audit_plugin)
|
|||
audit_status, /* status variables */
|
||||
audit_system_variables, /* system variables */
|
||||
NULL /* config options */
|
||||
}
|
||||
}
|
||||
mysql_declare_plugin_end;
|
||||
|
||||
#if MYSQL_VERSION_ID < 50505
|
||||
|
|
Loading…
Reference in New Issue