a helper function to report an access denied error in most proper places */
| 13735 | a helper function to report an access denied error in most proper places |
| 13736 | */ |
| 13737 | static void login_failed_error(THD *thd) |
| 13738 | { |
| 13739 | my_error(access_denied_error_code(thd->password), MYF(0), |
| 13740 | thd->main_security_ctx.user, |
| 13741 | thd->main_security_ctx.host_or_ip, |
| 13742 | thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO)); |
| 13743 | general_log_print(thd, COM_CONNECT, |
| 13744 | ER_THD(thd, access_denied_error_code(thd->password)), |
| 13745 | thd->main_security_ctx.user, |
| 13746 | thd->main_security_ctx.host_or_ip, |
| 13747 | thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO)); |
| 13748 | status_var_increment(thd->status_var.access_denied_errors); |
| 13749 | /* |
| 13750 | Log access denied messages to the error log when log-warnings = 2 |
| 13751 | so that the overhead of the general query log is not required to track |
| 13752 | failed connections. |
| 13753 | */ |
| 13754 | if (global_system_variables.log_warnings > 1) |
| 13755 | { |
| 13756 | sql_print_warning(ER_DEFAULT(access_denied_error_code(thd->password)), |
| 13757 | thd->main_security_ctx.user, |
| 13758 | thd->main_security_ctx.host_or_ip, |
| 13759 | thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO)); |
| 13760 | } |
| 13761 | } |
| 13762 | |
| 13763 | /** |
| 13764 | sends a server handshake initialization packet, the very first packet |
no test coverage detected