MySQL 8.0.40
Source Code Documentation
audit_null.cc File Reference
#include <mysql/plugin.h>
#include <mysql/plugin_audit.h>
#include <mysqld_error.h>
#include <stdio.h>
#include <sys/types.h>
#include "lex_string.h"
#include "m_ctype.h"
#include "my_compiler.h"
#include "my_inttypes.h"
#include "my_macros.h"
#include "my_sys.h"
#include "mysql/psi/mysql_mutex.h"
#include "thr_mutex.h"
#include "plugin/audit_null/audit_null_variables.h"

Macros

#define AUDIT_NULL_VAR(x)   static volatile int number_of_calls_##x;
 
#define AUDIT_NULL_VAR(x)
 

Functions

static MYSQL_THDVAR_STR (abort_message, PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_MEMALLOC, "Custom message for event abort.", nullptr, nullptr, nullptr)
 
static MYSQL_THDVAR_INT (abort_value, PLUGIN_VAR_RQCMDARG, "Event abort value.", nullptr, nullptr, 1, -1, 150, 0)
 
static MYSQL_THDVAR_STR (event_order_check, PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_MEMALLOC, "Event order check string", nullptr, nullptr, nullptr)
 
static MYSQL_THDVAR_UINT (event_order_check_consume_ignore_count, PLUGIN_VAR_RQCMDARG, "Do not consume event order string specified " "number of times.", nullptr, nullptr, 0, 0, UINT_MAX, 1)
 
static MYSQL_THDVAR_INT (event_order_started, PLUGIN_VAR_RQCMDARG, "Plugin is in the event order check.", nullptr, nullptr, 0, 0, 1, 0)
 
static MYSQL_THDVAR_INT (event_order_check_exact, PLUGIN_VAR_RQCMDARG, "Plugin checks exact event order.", nullptr, nullptr, 1, 0, 1, 0)
 
static MYSQL_THDVAR_STR (event_record_def, PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_MEMALLOC, "Event recording definition", nullptr, nullptr, nullptr)
 
static MYSQL_THDVAR_STR (event_record, PLUGIN_VAR_READONLY|PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_MEMALLOC, "Event recording", nullptr, nullptr, nullptr)
 
static int audit_null_plugin_init (void *arg)
 
static int audit_null_plugin_deinit (void *arg)
 
static LEX_CSTRING event_to_str (unsigned int event_class, unsigned long event_subclass)
 Converts event_class and event_subclass into a string. More...
 
static LEX_CSTRING get_token (char **str)
 Read token delimited by a semicolon from a string. More...
 
static char * add_event (const char *var, LEX_CSTRING event, const char *data, size_t data_length)
 
static void process_event_record (MYSQL_THD thd, LEX_CSTRING event_name, const char *data, size_t data_length)
 
static int process_command (MYSQL_THD thd, LEX_CSTRING event_command, bool consume_event)
 
static int audit_null_notify (MYSQL_THD thd, mysql_event_class_t event_class, const void *event)
 Plugin function handler. More...
 
 mysql_declare_plugin (audit_null)
 

Variables

LEX_CSTRING event_names [][6]
 Event strings. More...
 
static volatile int number_of_calls
 
static bool g_plugin_installed = false
 
static mysql_mutex_t g_record_buffer_mutex
 
static char * g_record_buffer
 
static SHOW_VAR simple_status []
 
static struct st_mysql_audit audit_null_descriptor
 
static SYS_VARsystem_variables []
 
 mysql_declare_plugin_end
 

Macro Definition Documentation

◆ AUDIT_NULL_VAR [1/2]

#define AUDIT_NULL_VAR (   x)    static volatile int number_of_calls_##x;

◆ AUDIT_NULL_VAR [2/2]

#define AUDIT_NULL_VAR (   x)
Value:
{"Audit_null_" #x, \
const_cast<char *>( \
reinterpret_cast<volatile char *>(&number_of_calls_##x)), \
SHOW_INT, SHOW_SCOPE_GLOBAL},
@ SHOW_SCOPE_GLOBAL
Definition: status_var.h:70

Function Documentation

◆ add_event()

static char * add_event ( const char *  var,
LEX_CSTRING  event,
const char *  data,
size_t  data_length 
)
static

◆ audit_null_notify()

static int audit_null_notify ( MYSQL_THD  thd,
mysql_event_class_t  event_class,
const void *  event 
)
static

Plugin function handler.

Parameters
[in]thdConnection context.
[in]event_classEvent class value.
[in]eventEvent data.
Return values
Valueindicating, whether the server should abort continuation of the current operation.

◆ audit_null_plugin_deinit()

static int audit_null_plugin_deinit ( void *  arg)
static

◆ audit_null_plugin_init()

static int audit_null_plugin_init ( void *  arg)
static

◆ event_to_str()

static LEX_CSTRING event_to_str ( unsigned int  event_class,
unsigned long  event_subclass 
)
static

Converts event_class and event_subclass into a string.

Parameters
[in]event_classEvent class value.
[in]event_subclassEvent subclass value.
Return values
Eventname.

◆ get_token()

static LEX_CSTRING get_token ( char **  str)
static

Read token delimited by a semicolon from a string.

Parameters
[in,out]strPointer to a string containing text. Pointer is moved to a new token after the function ends.
Return values
Tokenretrieved from a string.

◆ mysql_declare_plugin()

mysql_declare_plugin ( audit_null  )

◆ MYSQL_THDVAR_INT() [1/3]

static MYSQL_THDVAR_INT ( abort_value  ,
PLUGIN_VAR_RQCMDARG  ,
"Event abort value."  ,
nullptr  ,
nullptr  ,
,
1,
150  ,
 
)
static

◆ MYSQL_THDVAR_INT() [2/3]

static MYSQL_THDVAR_INT ( event_order_check_exact  ,
PLUGIN_VAR_RQCMDARG  ,
"Plugin checks exact event order."  ,
nullptr  ,
nullptr  ,
,
,
,
 
)
static

◆ MYSQL_THDVAR_INT() [3/3]

static MYSQL_THDVAR_INT ( event_order_started  ,
PLUGIN_VAR_RQCMDARG  ,
"Plugin is in the event order check."  ,
nullptr  ,
nullptr  ,
,
,
,
 
)
static

◆ MYSQL_THDVAR_STR() [1/4]

static MYSQL_THDVAR_STR ( abort_message  ,
PLUGIN_VAR_RQCMDARG PLUGIN_VAR_MEMALLOC,
"Custom message for event abort."  ,
nullptr  ,
nullptr  ,
nullptr   
)
static

◆ MYSQL_THDVAR_STR() [2/4]

static MYSQL_THDVAR_STR ( event_order_check  ,
PLUGIN_VAR_RQCMDARG PLUGIN_VAR_MEMALLOC,
"Event order check string"  ,
nullptr  ,
nullptr  ,
nullptr   
)
static

◆ MYSQL_THDVAR_STR() [3/4]

static MYSQL_THDVAR_STR ( event_record  ,
PLUGIN_VAR_READONLY|PLUGIN_VAR_RQCMDARG PLUGIN_VAR_MEMALLOC,
"Event recording"  ,
nullptr  ,
nullptr  ,
nullptr   
)
static

◆ MYSQL_THDVAR_STR() [4/4]

static MYSQL_THDVAR_STR ( event_record_def  ,
PLUGIN_VAR_RQCMDARG PLUGIN_VAR_MEMALLOC,
"Event recording definition"  ,
nullptr  ,
nullptr  ,
nullptr   
)
static

◆ MYSQL_THDVAR_UINT()

static MYSQL_THDVAR_UINT ( event_order_check_consume_ignore_count  ,
PLUGIN_VAR_RQCMDARG  ,
"Do not consume event order string specified " "number of times."  ,
nullptr  ,
nullptr  ,
,
,
UINT_MAX  ,
 
)
static

◆ process_command()

static int process_command ( MYSQL_THD  thd,
LEX_CSTRING  event_command,
bool  consume_event 
)
static

◆ process_event_record()

static void process_event_record ( MYSQL_THD  thd,
LEX_CSTRING  event_name,
const char *  data,
size_t  data_length 
)
static

Variable Documentation

◆ audit_null_descriptor

struct st_mysql_audit audit_null_descriptor
static
Initial value:
= {
nullptr,
{(unsigned long)MYSQL_AUDIT_GENERAL_ALL,
(unsigned long)MYSQL_AUDIT_PARSE_ALL,
0,
(unsigned long)MYSQL_AUDIT_COMMAND_ALL,
(unsigned long)MYSQL_AUDIT_QUERY_ALL,
(unsigned long)MYSQL_AUDIT_MESSAGE_ALL}}
static int audit_null_notify(MYSQL_THD thd, mysql_event_class_t event_class, const void *event)
Plugin function handler.
Definition: audit_null.cc:438
#define MYSQL_AUDIT_INTERFACE_VERSION
Definition: plugin_audit.h:41
#define MYSQL_AUDIT_GENERAL_ALL
Definition: plugin_audit.h:123
#define MYSQL_AUDIT_TABLE_ACCESS_ALL
Definition: plugin_audit.h:299
#define MYSQL_AUDIT_SERVER_STARTUP_ALL
Definition: plugin_audit.h:364
#define MYSQL_AUDIT_GLOBAL_VARIABLE_ALL
Definition: plugin_audit.h:337
#define MYSQL_AUDIT_CONNECTION_ALL
Definition: plugin_audit.h:147
#define MYSQL_AUDIT_COMMAND_ALL
Definition: plugin_audit.h:430
#define MYSQL_AUDIT_SERVER_SHUTDOWN_ALL
Definition: plugin_audit.h:390
#define MYSQL_AUDIT_AUTHENTICATION_ALL
Definition: plugin_audit.h:557
#define MYSQL_AUDIT_STORED_PROGRAM_ALL
Definition: plugin_audit.h:505
#define MYSQL_AUDIT_PARSE_ALL
Definition: plugin_audit.h:200
#define MYSQL_AUDIT_QUERY_ALL
Definition: plugin_audit.h:472
#define MYSQL_AUDIT_MESSAGE_ALL
Definition: plugin_audit.h:596

◆ event_names

LEX_CSTRING event_names[][6]

Event strings.

◆ g_plugin_installed

bool g_plugin_installed = false
static

◆ g_record_buffer

char* g_record_buffer
static

◆ g_record_buffer_mutex

mysql_mutex_t g_record_buffer_mutex
static

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ number_of_calls

volatile int number_of_calls
static

◆ simple_status

SHOW_VAR simple_status[]
static
Initial value:
= {
{"Audit_null_called",
const_cast<char *>(reinterpret_cast<volatile char *>(&number_of_calls)),
#define AUDIT_NULL_VAR(x)
{nullptr, nullptr, SHOW_UNDEF, SHOW_SCOPE_GLOBAL}}
static volatile int number_of_calls
Definition: audit_null.cc:119
@ SHOW_INT
shown as unsigned int
Definition: status_var.h:33
@ SHOW_UNDEF
Definition: status_var.h:31

◆ system_variables

SYS_VAR* system_variables[]
static
Initial value:
= {
MYSQL_SYSVAR(abort_message),
MYSQL_SYSVAR(abort_value),
MYSQL_SYSVAR(event_order_check),
MYSQL_SYSVAR(event_order_check_consume_ignore_count),
MYSQL_SYSVAR(event_order_started),
MYSQL_SYSVAR(event_order_check_exact),
MYSQL_SYSVAR(event_record_def),
MYSQL_SYSVAR(event_record),
nullptr}
#define MYSQL_SYSVAR(name)
Definition: plugin.h:252