1#ifndef SQL_AUDIT_INCLUDED
2#define SQL_AUDIT_INCLUDED
70#define AUDIT_EVENT(x) x, #x
88 unsigned long event_subclass,
89 bool check_audited =
true);
117 const char *subclass_name,
int status,
const char *
user,
const char *
host,
118 const char *authentication_plugin,
bool is_role,
const char *new_user,
119 const char *new_host);
138 const char *command_text);
152 const char *subclass_name,
int errcode);
167 const char *subclass_name);
183 const char *subclass_name,
int error_code,
const char *msg,
size_t msg_len);
214 const char *subclass_name,
const char *
name,
const char *value,
215 const unsigned int value_length);
236 const char *subclass_name,
const char *component,
size_t component_length,
237 const char *producer,
size_t producer_length,
const char *message,
238 size_t message_length,
240 size_t key_value_map_length);
255 const char *subclass_name,
272 const char *subclass_name);
301 const char **argv,
unsigned int argc);
317 const char *subclass_name,
const char *database,
const char *
name,
350 const char *subclass_name,
const char *database,
351 unsigned int database_length,
const char *
name,
352 unsigned int name_length);
367int mysql_audit_notify(
THD *thd,
369 const char *subclass_name,
370 const char *database,
396 std::vector<const char *> &auth_methods,
bool is_role,
397 const char *new_user,
const char *new_host)
402 new_user_{new_user, new_user ? strlen(new_user) : 0},
403 new_host_{new_host, new_host ? strlen(new_host) : 0} {}
417 size_t command_length)
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
A set of THD members describing the current authenticated user.
Definition: sql_security_ctx.h:54
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Data for authentication event tracking.
unsigned long mysql_event_tracking_authentication_subclass_t
Events for Authentication event tracking.
Definition: event_tracking_authentication_defs.h:72
Data for RPC command event tracking.
unsigned long mysql_event_tracking_command_subclass_t
Events for Command event tracking.
Definition: event_tracking_command_defs.h:47
Common data used for tracking various types of events.
Data for connection event tracking.
unsigned long mysql_event_tracking_connection_subclass_t
Events for Connection event tracking.
Definition: event_tracking_connection_defs.h:53
Data for general event tracking.
#define EVENT_TRACKING_GENERAL_LOG
occurs before emitting to the general query log.
Definition: event_tracking_general_defs.h:35
unsigned long mysql_event_tracking_general_subclass_t
Events for the General event tracking.
Definition: event_tracking_general_defs.h:52
Data for global variable event tracking.
unsigned long mysql_event_tracking_global_variable_subclass_t
Events for Global variable event tracking.
Definition: event_tracking_global_variable_defs.h:47
Data for program lifecycle events.
unsigned long mysql_event_tracking_shutdown_subclass_t
Events for Shutdown event tracking.
Definition: event_tracking_lifecycle_defs.h:68
unsigned long mysql_event_tracking_startup_subclass_t
Events for Startup event tracking.
Definition: event_tracking_lifecycle_defs.h:42
int mysql_event_tracking_shutdown_reason_t
Server shutdown reason.
Definition: event_tracking_lifecycle_defs.h:80
Data for message event tracking.
unsigned long mysql_event_tracking_message_subclass_t
Events for Message event tracking.
Definition: event_tracking_message_defs.h:47
Data for parse event tracking.
unsigned int mysql_event_tracking_parse_rewrite_plugin_flag
Query rewritting flags.
Definition: event_tracking_parse_defs.h:61
unsigned long mysql_event_tracking_parse_subclass_t
Events for Parse event tracking.
Definition: event_tracking_parse_defs.h:47
Data for query event tracking.
unsigned long mysql_event_tracking_query_subclass_t
Events for Query event tracking.
Definition: event_tracking_query_defs.h:52
Data for stored program event tracking.
unsigned long mysql_event_tracking_stored_program_subclass_t
Events for Stored program event tracking.
Definition: event_tracking_stored_program_defs.h:44
Data for query event tracking.
static int flags[50]
Definition: hp_test1.cc:40
enum_server_command
A list of all MySQL protocol commands.
Definition: my_command.h:48
static const char * command_name[]
Definition: myisamlog.cc:102
char * user
Definition: mysqladmin.cc:66
const char * host
Definition: mysqladmin.cc:65
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
mysql_event_authorization_subclass_t
Events for MYSQL_AUDIT_AUTHORIZATION_CLASS event class.
Definition: plugin_audit.h:236
mysql_event_class_t
Audit event classes.
Definition: plugin_audit.h:50
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:61
size_t make_user_name(Security_context *sctx, char *buf)
Definition: sql_audit.cc:816
void mysql_audit_enable_auditing(THD *thd)
Enable auditing of the specified THD.
Definition: sql_audit.cc:639
void mysql_audit_finalize()
Finalize Audit global variables.
Definition: sql_audit.cc:697
int mysql_event_tracking_query_notify(THD *thd, mysql_event_tracking_query_subclass_t subclass, const char *subclass_name)
Notify consumers of QUERY event tracking events.
Definition: sql_audit.cc:1092
bool is_global_audit_mask_set()
Checks presence of active audit plugin.
Definition: sql_audit.cc:808
int mysql_event_tracking_global_variable_notify(THD *thd, mysql_event_tracking_global_variable_subclass_t subclass, const char *subclass_name, const char *name, const char *value, const unsigned int value_length)
Notify consumers of GLOBAL VARIABLE event tracking events.
Definition: sql_audit.cc:1012
int mysql_event_tracking_parse_notify(THD *thd, mysql_event_tracking_parse_subclass_t subclass, const char *subclass_name, mysql_event_tracking_parse_rewrite_plugin_flag *flags, mysql_cstring_with_length *rewritten_query)
Notify consumers of PARSE event tracking events.
Definition: sql_audit.cc:1066
#define AUDIT_EVENT(x)
Audit API event to string expanding macro.
Definition: sql_audit.h:70
int mysql_event_tracking_message_notify(THD *thd, mysql_event_tracking_message_subclass_t subclass, const char *subclass_name, const char *component, size_t component_length, const char *producer, size_t producer_length, const char *message, size_t message_length, mysql_event_tracking_message_key_value_t *key_value_map, size_t key_value_map_length)
Notify consumers of MESSAGE event tracking events.
Definition: sql_audit.cc:1037
void mysql_audit_release(THD *thd)
Release any resources associated with the current thd.
Definition: sql_audit.cc:609
bool is_audit_plugin_class_active(THD *thd, unsigned long event_class)
There's at least one active audit plugin tracking a specified class.
Definition: sql_audit.cc:797
void mysql_audit_init_thd(THD *thd)
Initialize thd variables used by Audit.
Definition: sql_audit.cc:648
int mysql_event_tracking_general_notify(THD *thd, mysql_event_tracking_general_subclass_t subclass, const char *subclass_name, int error_code, const char *msg, size_t msg_len)
Notify consumers of GENERAL event tracking events.
Definition: sql_audit.cc:961
void mysql_audit_free_thd(THD *thd)
Free thd variables used by Audit.
Definition: sql_audit.cc:659
int initialize_audit_plugin(st_plugin_int *plugin)
Initialize an Audit plug-in.
Definition: sql_audit.cc:708
int finalize_audit_plugin(st_plugin_int *plugin)
Finalize an Audit plug-in.
Definition: sql_audit.cc:767
int mysql_event_tracking_table_access_notify(THD *thd, Table_ref *table)
Notify consumers of TABLE ACCESS event tracking events for all tables available in the list.
Definition: sql_audit.cc:1299
int mysql_event_tracking_shutdown_notify(mysql_event_tracking_shutdown_subclass_t subclass, const char *subclass_name, mysql_event_tracking_shutdown_reason_t reason, int exit_code)
Notify consumers of LIFECYCLE (Shutdown) event tracking events.
Definition: sql_audit.cc:1149
int mysql_event_tracking_connection_notify(THD *thd, mysql_event_tracking_connection_subclass_t subclass, const char *subclass_name, int errcode)
Notify consumers of CONNECTION event tracking events.
Definition: sql_audit.cc:905
void mysql_audit_initialize()
Initialize Audit global variables.
Definition: sql_audit.cc:684
int mysql_audit_acquire_plugins(THD *thd, mysql_event_class_t event_class, unsigned long event_subclass, bool check_audited=true)
Acquire audit plugins.
Definition: sql_audit.cc:549
int mysql_event_tracking_command_notify(THD *thd, mysql_event_tracking_command_subclass_t subclass, const char *subclass_name, enum_server_command command, const char *command_text)
Notify consumers of COMMAND event tracking events.
Definition: sql_audit.cc:869
int mysql_event_tracking_authentication_notify(THD *thd, mysql_event_tracking_authentication_subclass_t subclass, const char *subclass_name, int status, const char *user, const char *host, const char *authentication_plugin, bool is_role, const char *new_user, const char *new_host)
Notify consumers of AUTHENTICATION event tracking events.
Definition: sql_audit.cc:836
int mysql_event_tracking_stored_program_notify(THD *thd, mysql_event_tracking_stored_program_subclass_t subclass, const char *subclass_name, const char *database, const char *name, void *parameters)
Notify consumers of STORED PROGRAM event tracking events.
Definition: sql_audit.cc:1186
static const size_t MAX_USER_HOST_SIZE
Definition: sql_audit.h:53
int mysql_event_tracking_startup_notify(mysql_event_tracking_startup_subclass_t subclass, const char *subclass_name, const char **argv, unsigned int argc)
Notify consumers of LIFECYCLE (Starup) event tracking events.
Definition: sql_audit.cc:1164
Event_tracking_class
Event tracking classes If a new event tracking class is introduced, this class should be kept in sync...
Definition: sql_event_tracking_to_audit_event_mapping.h:41
case opt name
Definition: sslopt-case.h:29
Definition: mysql_lex_string.h:40
String with length information.
Definition: mysql_string_defs.h:33
Structure that stores key-value pair of the Message event.
Definition: event_tracking_message_defs.h:67
Definition: sql_audit.h:56
const void * event
Definition: sql_audit.h:58
Event_tracking_class event_class
Definition: sql_audit.h:57
const Event_tracking_information * event_information
Definition: sql_audit.h:59
Definition: sql_audit.h:62
const void * event
Definition: sql_audit.h:64
mysql_event_class_t event_class
Definition: sql_audit.h:63
Definition: sql_plugin_ref.h:45
st_mysql_plugin * plugin
Definition: sql_plugin_ref.h:47
command
Definition: version_token.cc:280