diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-05-13 21:34:16 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-05-14 16:38:13 +0200 |
commit | 29a0f5acf3b8025590ba38bae736a9ad10df4ed7 (patch) | |
tree | 847b87709c9d383cd4b4da6d870f8771054c3817 /sql/mysqld.cc | |
parent | c3ea52c92a23f72f49008f493b92f2692d7a1082 (diff) | |
download | mariadb-git-29a0f5acf3b8025590ba38bae736a9ad10df4ed7.tar.gz |
MDEV-19277: Add status variable that gets incremented if connection is aborted prior to authentication
MDEV-19282: Log more specific warning with log_warnings=2 if connection is aborted prior to authentication
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r-- | sql/mysqld.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index dbe6055d387..dec23535551 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -492,7 +492,7 @@ ulonglong query_cache_size=0; ulong query_cache_limit=0; ulong executed_events=0; query_id_t global_query_id; -ulong aborted_threads, aborted_connects; +ulong aborted_threads, aborted_connects, aborted_connects_preauth; ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size; ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use; ulong delayed_insert_errors,flush_time; @@ -2560,13 +2560,19 @@ static void network_init(void) void close_connection(THD *thd, uint sql_errno) { + int lvl= (thd->main_security_ctx.user ? 3 : 1); DBUG_ENTER("close_connection"); if (sql_errno) + { net_send_error(thd, sql_errno, ER_DEFAULT(sql_errno), NULL); - - thd->print_aborted_warning(3, sql_errno ? ER_DEFAULT(sql_errno) - : "CLOSE_CONNECTION"); + thd->print_aborted_warning(lvl, ER_DEFAULT(sql_errno)); + } + else + thd->print_aborted_warning(lvl, (thd->main_security_ctx.user ? + "This connection closed normally" : + "This connection closed normally without" + " authentication")); thd->disconnect(); @@ -7615,6 +7621,7 @@ int show_threadpool_idle_threads(THD *thd, SHOW_VAR *var, char *buff, SHOW_VAR status_vars[]= { {"Aborted_clients", (char*) &aborted_threads, SHOW_LONG}, {"Aborted_connects", (char*) &aborted_connects, SHOW_LONG}, + {"Aborted_connects_preauth", (char*) &aborted_connects_preauth, SHOW_LONG}, {"Acl", (char*) acl_statistics, SHOW_ARRAY}, {"Access_denied_errors", (char*) offsetof(STATUS_VAR, access_denied_errors), SHOW_LONG_STATUS}, {"Binlog_bytes_written", (char*) offsetof(STATUS_VAR, binlog_bytes_written), SHOW_LONGLONG_STATUS}, @@ -8026,7 +8033,7 @@ static int mysql_init_variables(void) opt_using_transactions= 0; abort_loop= select_thread_in_use= signal_thread_in_use= 0; grant_option= 0; - aborted_threads= aborted_connects= 0; + aborted_threads= aborted_connects= aborted_connects_preauth= 0; subquery_cache_miss= subquery_cache_hit= 0; delayed_insert_threads= delayed_insert_writes= delayed_rows_in_use= 0; delayed_insert_errors= thread_created= 0; |