changeset 19591:effb67b92547

pop3c: If authentication fails, log if it was done with USER+PASS or AUTH PLAIN
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 19 Jan 2016 02:30:53 +0200
parents 791a8c6f4770
children cf3fdf335484
files src/lib-storage/index/pop3c/pop3c-client.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/pop3c/pop3c-client.c	Tue Jan 19 02:26:24 2016 +0200
+++ b/src/lib-storage/index/pop3c/pop3c-client.c	Tue Jan 19 02:30:53 2016 +0200
@@ -54,6 +54,7 @@
 
 	enum pop3c_client_state state;
 	enum pop3c_capability capabilities;
+	const char *auth_mech;
 
 	pop3c_login_callback_t *login_callback;
 	void *login_context;
@@ -370,6 +371,7 @@
 		o_stream_nsend_str(client->output,
 			t_strdup_printf("PASS %s\r\n", client->set.password));
 		client->state = POP3C_CLIENT_STATE_PASS;
+		client->auth_mech = "USER+PASS";
 		break;
 	case POP3C_CLIENT_STATE_AUTH:
 		if (line[0] != '+') {
@@ -380,6 +382,7 @@
 		o_stream_nsend_str(client->output,
 			pop3c_client_get_sasl_plain_request(client));
 		client->state = POP3C_CLIENT_STATE_PASS;
+		client->auth_mech = "AUTH PLAIN";
 		break;
 	case POP3C_CLIENT_STATE_PASS:
 		if (client->login_callback != NULL) {
@@ -390,8 +393,8 @@
 					      POP3C_COMMAND_STATE_OK :
 					      POP3C_COMMAND_STATE_ERR, reply);
 		} else if (!success) {
-			i_error("pop3c(%s): Authentication failed: %s",
-				client->set.host, line);
+			i_error("pop3c(%s): Authentication via %s failed: %s",
+				client->set.host, client->auth_mech, line);
 		}
 		if (!success)
 			return -1;