dovecot-2.1: login: If login fails for some reason, but auth was...

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 8 21:19:10 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/d03524bfcf16
changeset: 13671:d03524bfcf16
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 08 21:29:34 2011 +0200
description:
login: If login fails for some reason, but auth was successful, don't log "auth failed".
For example if proxy fails to connect to remote server.

diffstat:

 src/login-common/client-common.c |  4 ++++
 src/login-common/client-common.h |  2 +-
 src/login-common/sasl-server.c   |  1 +
 3 files changed, 6 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r d9b89af302e7 -r d03524bfcf16 src/login-common/client-common.c
--- a/src/login-common/client-common.c	Tue Nov 08 21:14:32 2011 +0200
+++ b/src/login-common/client-common.c	Tue Nov 08 21:29:34 2011 +0200
@@ -528,6 +528,10 @@
 	if (client->auth_try_aborted && client->auth_attempts == 1)
 		return "(aborted authentication)";
 
+	if (client->auth_successes > 0) {
+		return t_strdup_printf("(internal failure, %u succesful auths)",
+				       client->auth_successes);
+	}
 	return t_strdup_printf("(auth failed, %u attempts)",
 			       client->auth_attempts);
 }
diff -r d9b89af302e7 -r d03524bfcf16 src/login-common/client-common.h
--- a/src/login-common/client-common.h	Tue Nov 08 21:14:32 2011 +0200
+++ b/src/login-common/client-common.h	Tue Nov 08 21:29:34 2011 +0200
@@ -106,7 +106,7 @@
 	sasl_server_callback_t *sasl_callback;
 
 	unsigned int bad_counter;
-	unsigned int auth_attempts;
+	unsigned int auth_attempts, auth_successes;
 	pid_t mail_pid;
 
 	char *virtual_user;
diff -r d9b89af302e7 -r d03524bfcf16 src/login-common/sasl-server.c
--- a/src/login-common/sasl-server.c	Tue Nov 08 21:14:32 2011 +0200
+++ b/src/login-common/sasl-server.c	Tue Nov 08 21:29:34 2011 +0200
@@ -221,6 +221,7 @@
 		break;
 	case AUTH_REQUEST_STATUS_OK:
 		client->auth_request = NULL;
+		client->auth_successes++;
 
 		nologin = FALSE;
 		for (i = 0; args[i] != NULL; i++) {


More information about the dovecot-cvs mailing list