summaryrefslogtreecommitdiff
path: root/sql/sql_audit.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge 10.2 into 10.3Marko Mäkelä2019-12-271-6/+16
|\
| * MDE-21369 rpl.rpl_timezone fails with valgrind: Use of uninitialised value.Alexey Botchkov2019-12-211-6/+16
| | | | | | | | | | It's not safe to chenge the THD::thread_id. So send the thread_id as an argument to the mysql_audit_external_lock.
* | Merge 10.2 into 10.3Marko Mäkelä2019-07-021-0/+1
|\ \ | |/
| * Merge 10.1 into 10.2Eugene Kosov2019-06-231-0/+1
| |\
| | * MDEV-18661 loading the audit plugin causes performance regression.Alexey Botchkov2019-06-151-0/+1
| | | | | | | | | | | | | | | | | | Plugin fixed to not lock the LOCK_operations when not active. Server fixed to lock the LOCK_plugin less - do it once per thread and then only if a plugin was installed/uninstalled.
* | | Merge 10.2 into 10.3Marko Mäkelä2019-05-141-1/+1
|\ \ \ | |/ /
| * | Merge 10.1 into 10.2Marko Mäkelä2019-05-131-1/+1
| |\ \ | | |/
| | * Merge branch '5.5' into 10.1Vicențiu Ciorbaru2019-05-111-1/+1
| | |\
| | | * Update FSF AddressVicențiu Ciorbaru2019-05-111-1/+1
| | | | | | | | | | | | | | | | * Update wrong zip-code
* | | | Changed database, tablename and alias to be LEX_CSTRINGMonty2018-01-301-51/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was done in, among other things: - thd->db and thd->db_length - TABLE_LIST tablename, db, alias and schema_name - Audit plugin database name - lex->db - All db and table names in Alter_table_ctx - st_select_lex db Other things: - Changed a lot of functions to take const LEX_CSTRING* as argument for db, table_name and alias. See init_one_table() as an example. - Changed some function arguments from LEX_CSTRING to const LEX_CSTRING - Changed some lists from LEX_STRING to LEX_CSTRING - threads_mysql.result changed because process list_db wasn't always correctly updated - New append_identifier() function that takes LEX_CSTRING* as arguments - Added new element tmp_buff to Alter_table_ctx to separate temp name handling from temporary space - Ensure we store the length after my_casedn_str() of table/db names - Removed not used version of rename_table_in_stat_tables() - Changed Natural_join_column::table_name and db_name() to never return NULL (used for print) - thd->get_db() now returns db as a printable string (thd->db.str or "")
* | | | Merge bb-10.2-ext into 10.3Marko Mäkelä2017-10-041-38/+49
|\ \ \ \ | |/ / /
| * | | MDEV-13384 - misc Windows warnings fixedVladislav Vaintroub2017-09-281-38/+49
| | | |
* | | | New option for slow logging (log_slow_disable_statements)Monty2017-08-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes MDEV-7742 and MDEV-8305 (Allow user to specify if stored procedures should be logged in the slow and general log) New functionality: - Added new variables log_slow_disable_statements and log_disable_statements that can be used to disable logging of certain queries to slow and general log. Currently supported options are 'admin', 'call', 'slave' and 'sp'. Defaults are as before. Only 'sp' (stored procedure statements) is disabled for slow and general_log. - Slow log to files now includes the following new information: - When logging stored procedure statements the name of stored procedure is logged. - Number of created tmp_tables, tmp_disk_tables and the space used by temporary tables. - When logging 'call', the logged status now contains the sum of all included statements. Before only 'time' was correct. - Added filsort_priority_queue as an option for log_slow_filter (this variable existed before, but was not exposed) - Added support for BIT types in my_getopt() Mapped some old variables to bitmaps (old variables can still be used) - Variable 'log_queries_not_using_indexes' is mapped to log_slow_filter='not_using_index' - Variable 'log_slow_slave_statements' is mapped to log_slow_disabled_statements='slave' - Variable 'log_slow_admin_statements' is mapped to log_slow_disabled_statements='admin' - All the above variables are changed to session variables from global variables Other things: - Simplified LOGGER::log_command. We don't need to check for super if OPTION_LOG_OFF is set as this flag can only be set if one is a super user. - Removed some setting of enable_slow_log as it's guaranteed to be set by mysql_parse() - mysql_admin_table() now sets thd->enable_slow_log - Added prepare_logs_for_admin_command() to reset thd->enable_slow_log if needed. - Added new functions to store, restore and add slow query status - Added new functions to store and restore query start time - Reorganized Sub_statement_state according to types - Added code in dispatch_command() to ensure that thd->reset_for_next_command() is always called for a query. - Added thd->last_sql_command to simplify checking of what was the type of the last command. Needed when logging to slow log as lex->sql_command may have changed before slow logging is called. - Moved QPLAN_TMP_... to where status for tmp tables are updated - Added new THD variable, affected_rows, to be able to correctly log number of affected rows to slow log.
* | | | Enusure that my_global.h is included firstMichael Widenius2017-08-241-2/+0
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added sql/mariadb.h file that should be included first by files in sql directory, if sql_plugin.h is not used (sql_plugin.h adds SHOW variables that must be done before my_global.h is included) - Removed a lot of include my_global.h from include files - Removed include's of some files that my_global.h automatically includes - Removed duplicated include's of my_sys.h - Replaced include my_config.h with my_global.h
* | | MDEV-13060 Server Audit Plugin Crashes with AWS KMS pluginSergei Golubchik2017-07-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | don't do auditing if thd is NULL. Collaterals: * copy-paste bugs server_audit.c * uninitialized user field when thd in NULL
* | | Fix many -Wconversion warnings.Marko Mäkelä2017-03-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Define my_thread_id as an unsigned type, to avoid mismatch with ulonglong. Change some parameters to this type. Use size_t in a few more places. Declare many flag constants as unsigned to avoid sign mismatch when shifting bits or applying the unary ~ operator. When applying the unary ~ operator to enum constants, explictly cast the result to an unsigned type, because enum constants can be treated as signed. In InnoDB, change the source code line number parameters from ulint to unsigned type. Also, make some InnoDB functions return a narrower type (unsigned or uint32_t instead of ulint; bool instead of ibool).
* | | fix most annoying warnings on WindowsVladislav Vaintroub2016-03-221-10/+10
| | |
* | | MDEV-9651 - Simplify audit event dispatchingSergey Vojtovich2016-03-081-107/+239
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simplified audit event dispatching call chain from: mysql_audit_notify_connection_connect() // can be inlined mysql_audit_notify() // can't be inlined connection_class_handler() // can't be inlined event_class_dispatch() // can be inlined plugins_dispatch() // can be inlined plugin->event_notify() // can't be inlined to: mysql_audit_notify_connection_connect() // can be inlined mysql_audit_notify() // can't be inlined plugins_dispatch() // can be inlined plugin->event_notify() // can't be inlined
* | Merge with 10.0-baseMichael Widenius2014-03-131-2/+10
|\ \ | | | | | | | | | | | | Automatic merge, except for server_audit.cc that had to be modified slightly Changes to xtradb and innobase where ignored was these made no sence for 10.0
| * \ Merge with 5.5Michael Widenius2014-03-111-2/+10
| |\ \ | | |/
| | * MDEV-5436 mysqld crash signal 11 in mysql_audit_general.Alexey Botchkov2014-02-281-2/+10
| | | | | | | | | | | | | | | | | | | | | That error 'Can't open the pid file' leads to mysqld crash signal 11 in mysql_audit_general() called with the 'thd' parameter set to NULL. That wasn't checked when the thd->db and thd->db_length were accessed. Fixed by checking for the NULL thd.
* | | 10.0-base mergeSergei Golubchik2014-02-261-1/+1
|\ \ \ | |/ /
| * | 5.5 mergeSergei Golubchik2014-02-251-1/+1
| |\ \ | | |/
| | * MySQL-5.5.36 mergeSergei Golubchik2014-02-171-1/+1
| | |\ | | | | | | | | | | | | (without few incorrect bugfixes and with 1250 files where only a copyright year was changed)
| | | * Updated/added copyright headersMurthy Narkedimilli2014-01-061-1/+1
| | | |
| | | * WL#7076: Backporting wl6715 to support both formats Ashish Agarwal2013-08-231-23/+59
| | | |\ | | | | | | | | | | | | | | | in 5.5, 5.6, 5.7.
| | | | * WL#7076: Backporting wl6715 to support both formats in 5.5, 5.6, 5.7Ashish Agarwal2013-07-021-22/+58
| | | |/ | | | | | | | | | | | | Backporting wl6715 to mysql-5.5
* | | | 10.0-base merge.Sergei Golubchik2013-09-211-3/+13
|\ \ \ \ | |/ / / | | | | | | | | | | | | Partitioning/InnoDB changes are *not* merged (they'll come from 5.6) TokuDB does not compile (not updated to 10.0 SE API)
| * | | 5.5 merge and fixes for compiler/test errorsSergei Golubchik2013-09-181-3/+13
| |\ \ \ | | |/ /
| | * | MDEV-4472 Audit-plugin. Server-related part of the task.Alexey Botchkov2013-09-091-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | file_logger became the service. Data like query_id now are sent to the audit plugin. Fix for MDEV-4770 ported from 10.0. Fix added for the read_maria_plugin_info(). Log rotation can be disabled with 'set rotations=0'.
* | | | 10.0-monty mergeSergei Golubchik2013-07-211-3/+5
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | includes: * remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING" * introduce LOCK_share, now LOCK_ha_data is strictly for engines * rea_create_table() always creates .par file (even in "frm-only" mode) * fix a 5.6 bug, temp file leak on dummy ALTER TABLE
| * | | Applied all changes from Igor and SanjaMichael Widenius2013-06-151-3/+3
| | | |
* | | | 5.5 mergeSergei Golubchik2013-06-061-1/+90
|\ \ \ \ | | |/ / | |/| |
| * | | MDEV-260 auditing table accessesSergei Golubchik2013-04-191-1/+90
| |/ /
* | | prefer static inline functions to macros.Sergei Golubchik2013-04-091-36/+59
|/ / | | | | | | avoid unnecessary strlen()'s
* | Test case and a different fix for MySQL bug#14485479Sergei Golubchik2013-01-151-1/+1
| |
* | MDEV-259 audit plugin does not see sub-statementsSergei Golubchik2012-11-081-6/+9
| |
* | MDEV-258 audit plugin only see queries if general log is enabledSergei Golubchik2012-11-081-6/+7
|/
* Updated/added copyright headersKent Boortz2011-06-301-2/+2
|
* Bug #58699 cannot build with gcc dbg on solarisTor Didriksen2010-12-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cmake/os/SunOS.cmake: Remove TARGET_OS_SOLARIS config.h.cmake: Remove TARGET_OS_SOLARIS Add PTHREAD_ONCE_INITIALIZER configure.cmake: Add function for testing whether we need { PTHREAD_ONCE_INIT } rather than PTHREAD_ONCE_INIT include/my_pthread.h: Use PTHREAD_ONCE_INITIALIZER if set by cmake. include/mysql/psi/mysql_file.h: Include my_global.h first, to get correct platform definitions. mysys/ptr_cmp.c: Hide the unused static functions in #ifdef's on solaris. Use __sun (defined by both gcc and SunPro cc) rather than TARGET_OS_SOLARIS sql/my_decimal.cc: Include my_global.h first, to get correct platform definitions. sql/mysqld.cc: Fix signed/unsigned comparison warning. sql/sql_audit.h: Include my_global.h first, to get correct platform definitions. sql/sql_plugin.h: Include my_global.h first, to get correct platform definitions. sql/sql_show.cc: Fix: warning: cast from pointer to integer of different size sql/sys_vars.h: Use reinterpret_cast rather than c-style cast. storage/perfschema/pfs_instr.cc: Include my_global.h first, to get correct platform definitions.
* WL#5571 - Audit interface: MYSQL_AUDIT_GENERAL_STATUS eventSergey Vojtovich2010-12-141-0/+41
| | | | | | | | | | | | | | | | | include/mysql/plugin_audit.h: Connection auditing class. include/mysql/plugin_audit.h.pp: Connection auditing class. sql/mysqld.cc: Notify disconnect to auditing. sql/sql_audit.cc: Connection class event dispatcher. sql/sql_audit.h: mysql_audit_notify() is not available in embedded. sql/sql_connect.cc: Notify connect to auditing. sql/sql_parse.cc: Notify user change to auditing.
* Bug#57306 SHOW PROCESSLIST does not display string literals well.Alexander Barkov2010-11-181-10/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Extended characters outside of ASCII range where not displayed properly in SHOW PROCESSLIST, because thd_info->query was always sent as system_character_set (utf8). This was wrong, because query buffer is never converted to utf8 - it is always have client character set. Fix: sending query buffer using query character set @ sql/sql_class.cc @ sql/sql_class.h Introducing a new class CSET_STRING, a LEX_STRING with character set. Adding set_query(&CSET_STRING) Adding reset_query(), to use instead of set_query(0, NULL). @ sql/event_data_objects.cc Using reset_query() @ sql/log_event.cc Using reset_query() Adding charset argument to set_query_and_id(). @ sql/slave.cc Using reset_query(). @ sql/sp_head.cc Changing backing up and restore code to use CSET_STRING. @ sql/sql_audit.h Using CSET_STRING. In the "else" branch it's OK not to use global_system_variables.character_set_client. &my_charset_latin1, which is set in constructor, is fine (verified with Sergey Vojtovich). @ sql/sql_insert.cc Using set_query() with proper character set: table_name is utf8. @ sql/sql_parse.cc Adding character set argument to set_query_and_id(). (This is the main point where thd->charset() is stored into thd->query_string.cs, for use in "SHOW PROCESSLIST".) Using reset_query(). @ sql/sql_prepare.cc Storing client character set into thd->query_string.cs. @ sql/sql_show.cc Using CSET_STRING to fetch and send charset-aware query information from threads. @ storage/myisam/ha_myisam.cc Using set_query() with proper character set: table_name is utf8. @ mysql-test/r/show_check.result @ mysql-test/t/show_check.test Adding tests
* merge of mysql-5.5 into mysql-5.5-wl1054Georgi Kodinov2010-09-201-0/+1
|\
| * BUG#54989 - With null_audit installed, server hangs on anSergey Vojtovich2010-08-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | attempt to install a plugin twice Server crashes when [UN]INSTALL PLUGIN fails (returns an error) and general log is disabled and there are audit plugins interested in MYSQL_AUDIT_GENERAL_CLASS. When audit event is triggered, audit subsystem acquires interested plugins by walking through plugin list. Evidently plugin list iterator protects plugin list by acquiring LOCK_plugin, see plugin_foreach_with_mask(). On the other hand [UN]INSTALL PLUGIN is acquiring LOCK_plugin rather for a long time. When audit event is triggered during [UN]INSTALL PLUGIN, plugin list iterator acquires the same lock (within the same thread) second time. Repeatable only with general_log disabled, because general_log triggers MYSQL_AUDIT_GENERAL_LOG event, which acquires audit plugins before [UN]INSTALL PLUGIN acquired LOCK_plugin. With this fix we pre-acquire audit plugins for events that may potentially occur during [UN]INSTALL PLUGIN. This hack should be removed when LOCK_plugin is fixed so it protects only what it supposed to protect. No test case for this fix - we do not have facility to test audit plugins yet. sql/sql_audit.cc: Move "acquire audit plugin" logics to a separate function. sql/sql_audit.h: Move "acquire audit plugin" logics to a separate function. sql/sql_plugin.cc: Pre-acquire audit plugins for events that may potentially occur during [UN]INSTALL PLUGIN.
* | WL#1054: Pluggable authentication supportGeorgi Kodinov2010-08-091-1/+1
|/ | | | | Merged the implementation to a new base tree.
* WL#5030: Split and remove mysql_priv.hMats Kindahl2010-03-311-0/+1
| | | | | | | | | | | | | | This patch: - Moves all definitions from the mysql_priv.h file into header files for the component where the variable is defined - Creates header files if the component lacks one - Eliminates all include directives from mysql_priv.h - Eliminates all circular include cycles - Rename time.cc to sql_time.cc - Rename mysql_priv.h to sql_priv.h
* Backport from 6.0-codebase.Sergey Vojtovich2009-12-161-17/+70
| | | | | | | | | | | | | | | | | | | | | Bug #36098 Audit plugin (wl 3771) feature disabled in 6.0 avoid recusrive locking of LOCK_plugin include/mysql/plugin_audit.h: fix incorrect version sql/log.cc: move the common code to a shared header sql/mysqld.cc: restore the deleted functionality sql/set_var.cc: remove unused parameter sql/sql_audit.h: two inline convenience functions sql/sql_parse.cc: use a simplified convenience call sql/sql_plugin.cc: unlock LOCK_plugin for plugin->init() call, add missing OOM check, issue "unknown variable" error in find_sys_var, not down the stack
* Backport from 6.0-codebase.Sergey Vojtovich2009-12-151-0/+78
WL#3771 "Audit Plugin Interface" Implement new plug-in type - AUDIT New plug-in: audit_null simply increments counter for how many times it was called. include/Makefile.am: wl3771 add new headers to distribution include/mysql/plugin.h: wl3771 define new AUDIT plugin type Split out fulltext plugin type into its own header include/mysql/plugin.h.pp: wl3771 no real API change, just re-arranged some code include/mysql/plugin_audit.h: wl3771 pluggable audit interface include/mysql/plugin_ftparser.h: wl3771 Split out fulltext plugin type into its own header libmysqld/CMakeLists.txt: wl3771 add sql_audit.cc to build libmysqld/Makefile.am: wl3771 add sql_audit.cc to build plugin/audit_null: wl3771 an example plugin for testing pluggable audit interface plugin/audit_null/Makefile.am: wl3771 an example plugin for testing pluggable audit interface plugin/audit_null/audit_null.c: wl3771 an example plugin for testing pluggable audit interface plugin/audit_null/plug.in: wl3771 an example plugin for testing pluggable audit interface sql/CMakeLists.txt: wl3771 add sql_audit.cc to build sql/Makefile.am: wl3771 add sql_audit.cc to build sql/event_queue.cc: wl3771 release audit resources before waiting sql/log.cc: wl3771 add general audit call for log sql/mysqld.cc: wl3771 add audit initialize/finalize add general audit call for error sql/sql_audit.cc: wl3771 pluggable audit interface implementation sql/sql_audit.h: wl3771 pluggable audit interface implementation sql/sql_class.cc: wl3771 add thd audit init/deinit calls sql/sql_class.h: wl3771 add required data structures for audit to THD sql/sql_connect.cc: wl3771 release audit resources before waiting sql/sql_insert.cc: wl3771 release audit plugins before waiting sql/sql_parse.cc: wl3771 add general audit call for results sql/sql_plugin.cc: wl3771 add declarations for audit plugin type