diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test index 6fc0f3421a7..e16256d48df 100644 --- a/mysql-test/t/log_state.test +++ b/mysql-test/t/log_state.test @@ -37,7 +37,6 @@ set session long_query_time=1; select sleep(2); --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME select * from mysql.slow_log; -disconnect con1; connection default; show global variables where Variable_name = 'log' or Variable_name = 'log_slow_queries' or @@ -121,3 +120,8 @@ drop table t1; select * from mysql.general_log; --enable_ps_protocol + +# +# Cleanup (must be done last to avoid delayed 'Quit' message in general log) +# +disconnect con1; diff --git a/plugin/daemon_example/daemon_example.c b/plugin/daemon_example/daemon_example.c index ed9fac7574f..b70d8972095 100644 --- a/plugin/daemon_example/daemon_example.c +++ b/plugin/daemon_example/daemon_example.c @@ -19,11 +19,11 @@ #include /* -#if !defined(__attribute__) && (defined(__cplusplus) || !defined(__GNUC__) || __GNUC__ == 2 && __GNUC_MINOR__ < 8) + Disable __attribute__() on non-gcc compilers. +*/ +#if !defined(__attribute__) && !defined(__GNUC__) #define __attribute__(A) #endif -*/ - /* diff --git a/sql-common/client.c b/sql-common/client.c index c6938f01579..e8301e2c3e0 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -682,7 +682,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command, mysql->info=0; mysql->affected_rows= ~(my_ulonglong) 0; /* - We don't want to clear the protocol buffer on COM_QUIT, beacsue if + We don't want to clear the protocol buffer on COM_QUIT, because if the previous command was a shutdown command, we may have the response for the COM_QUIT already in the communication buffer */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3f734dbbdac..09e04e6a2f9 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -413,7 +413,11 @@ int check_user(THD *thd, enum enum_server_command command, } } - /* Why logging is performed before all checks've passed? */ + /* + Log the command before authentication checks, so that the user can + check the log for the tried login tried and also to detect + break-in attempts. + */ general_log_print(thd, command, (thd->main_security_ctx.priv_user == thd->main_security_ctx.user ?