a helper function to report an access denied error in all the proper places */
| 9795 | a helper function to report an access denied error in all the proper places |
| 9796 | */ |
| 9797 | static void login_failed_error(MPVIO_EXT *mpvio, int passwd_used) |
| 9798 | { |
| 9799 | THD *thd= current_thd; |
| 9800 | if (passwd_used == 2) |
| 9801 | { |
| 9802 | my_error(ER_ACCESS_DENIED_NO_PASSWORD_ERROR, MYF(0), |
| 9803 | mpvio->auth_info.user_name, |
| 9804 | mpvio->auth_info.host_or_ip); |
| 9805 | general_log_print(thd, COM_CONNECT, ER(ER_ACCESS_DENIED_NO_PASSWORD_ERROR), |
| 9806 | mpvio->auth_info.user_name, |
| 9807 | mpvio->auth_info.host_or_ip); |
| 9808 | /* |
| 9809 | Log access denied messages to the error log when log-warnings = 2 |
| 9810 | so that the overhead of the general query log is not required to track |
| 9811 | failed connections. |
| 9812 | */ |
| 9813 | if (log_warnings > 1) |
| 9814 | { |
| 9815 | sql_print_warning(ER(ER_ACCESS_DENIED_NO_PASSWORD_ERROR), |
| 9816 | mpvio->auth_info.user_name, |
| 9817 | mpvio->auth_info.host_or_ip); |
| 9818 | } |
| 9819 | } |
| 9820 | else |
| 9821 | { |
| 9822 | my_error(ER_ACCESS_DENIED_ERROR, MYF(0), |
| 9823 | mpvio->auth_info.user_name, |
| 9824 | mpvio->auth_info.host_or_ip, |
| 9825 | passwd_used ? ER(ER_YES) : ER(ER_NO)); |
| 9826 | general_log_print(thd, COM_CONNECT, ER(ER_ACCESS_DENIED_ERROR), |
| 9827 | mpvio->auth_info.user_name, |
| 9828 | mpvio->auth_info.host_or_ip, |
| 9829 | passwd_used ? ER(ER_YES) : ER(ER_NO)); |
| 9830 | /* |
| 9831 | Log access denied messages to the error log when log-warnings = 2 |
| 9832 | so that the overhead of the general query log is not required to track |
| 9833 | failed connections. |
| 9834 | */ |
| 9835 | if (log_warnings > 1) |
| 9836 | { |
| 9837 | sql_print_warning(ER(ER_ACCESS_DENIED_ERROR), |
| 9838 | mpvio->auth_info.user_name, |
| 9839 | mpvio->auth_info.host_or_ip, |
| 9840 | passwd_used ? ER(ER_YES) : ER(ER_NO)); |
| 9841 | } |
| 9842 | } |
| 9843 | } |
| 9844 | |
| 9845 | /** |
| 9846 | sends a server handshake initialization packet, the very first packet |