diff -u dovecot-0.99.14/src/pop3-login/client-authenticate.c.orig dovecot-0.99.14/src/pop3-login/client-authenticate.c --- dovecot-0.99.14/src/pop3-login/client-authenticate.c.orig 2005-07-27 16:52:12.936927405 -0400 +++ dovecot-0.99.14/src/pop3-login/client-authenticate.c 2005-07-27 16:52:31.806073234 -0400 @@ -139,6 +139,8 @@ master_callback, &error)) { case -1: /* login failed */ + client_syslog(client,t_strdup_printf("AUTHENTICATE FAILED %s", + error ? error : "")); client_auth_abort(client, error); break; @@ -214,6 +216,8 @@ master_callback, &error)) { case -1: /* login failed */ + client_syslog(client,t_strdup_printf("AUTHENTICATE FAILED %s", + error ? error : "")); client_auth_abort(client, error); break; diff -u dovecot-0.99.14/src/login-common/auth-common.c.orig dovecot-0.99.14/src/login-common/auth-common.c diff -u dovecot-0.99.14/src/auth/mech.c.orig dovecot-0.99.14/src/auth/mech.c --- dovecot-0.99.14/src/auth/mech.c.orig 2005-07-27 16:39:33.637767234 -0400 +++ dovecot-0.99.14/src/auth/mech.c 2005-07-27 16:41:10.206163232 -0400 @@ -162,6 +162,29 @@ return buffer_get_modifyable_data(buf, NULL); } +void *mech_auth_failure(struct auth_login_reply *reply, + struct auth_request *auth_request, + const void *data, size_t data_size) +{ + buffer_t *buf; + + buf = buffer_create_dynamic(data_stack_pool, 256, (size_t)-1); + + reply->username_idx = 0; + buffer_append(buf, auth_request->user, strlen(auth_request->user)+1); + + if (data_size == 0) + reply->reply_idx = (size_t)-1; + else { + reply->reply_idx = buffer_get_used_size(buf); + buffer_append(buf, data, data_size); + } + + reply->result = AUTH_LOGIN_RESULT_FAILURE; + reply->data_size = buffer_get_used_size(buf); + return buffer_get_modifyable_data(buf, NULL); +} + void mech_auth_finish(struct auth_request *auth_request, const void *data, size_t data_size, int success) { @@ -176,7 +199,8 @@ data, data_size); reply.result = AUTH_LOGIN_RESULT_SUCCESS; } else { - reply_data = NULL; + reply_data = mech_auth_failure(&reply, auth_request, + data, data_size); reply.result = AUTH_LOGIN_RESULT_FAILURE; } diff -u dovecot-0.99.14/src/imap-login/client-authenticate.c.orig dovecot-0.99.14/src/imap-login/client-authenticate.c --- dovecot-0.99.14/src/imap-login/client-authenticate.c.orig 2005-07-27 16:46:43.986682432 -0400 +++ dovecot-0.99.14/src/imap-login/client-authenticate.c 2005-07-27 16:52:32.390984759 -0400 @@ -135,6 +135,8 @@ master_callback, &error)) { case -1: /* login failed */ + client_syslog(client,t_strdup_printf("AUTHENTICATE FAILED %s", + error ? error : "")); client_auth_abort(client, error); break; @@ -215,6 +217,8 @@ master_callback, &error)) { case -1: /* login failed */ + client_syslog(client,t_strdup_printf("AUTHENTICATE FAILED %s", + error ? error : "")); client_auth_abort(client, error); break;