dovecot-2.1: login: Differentiate between auth failure and auth ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Nov 18 16:17:05 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/dd66ea0e7d00
changeset: 13723:dd66ea0e7d00
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Nov 18 16:16:34 2011 +0200
description:
login: Differentiate between auth failure and auth process communication failure.
Log a warning if auth connection dies.

diffstat:

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

diffs (93 lines):

diff -r 2ecd0e90402a -r dd66ea0e7d00 src/lib-auth/auth-client-request.c
--- a/src/lib-auth/auth-client-request.c	Fri Nov 18 16:15:24 2011 +0200
+++ b/src/lib-auth/auth-client-request.c	Fri Nov 18 16:16:34 2011 +0200
@@ -133,7 +133,7 @@
 	*_request = NULL;
 
 	auth_client_send_cancel(request->conn->client, request->id);
-	call_callback(request, AUTH_REQUEST_STATUS_FAIL, NULL, NULL);
+	call_callback(request, AUTH_REQUEST_STATUS_ABORT, NULL, NULL);
 }
 
 unsigned int auth_client_request_get_id(struct auth_client_request *request)
@@ -182,6 +182,8 @@
 		args = NULL;
 		break;
 	case AUTH_REQUEST_STATUS_FAIL:
+	case AUTH_REQUEST_STATUS_INTERNAL_FAIL:
+	case AUTH_REQUEST_STATUS_ABORT:
 		break;
 	}
 
diff -r 2ecd0e90402a -r dd66ea0e7d00 src/lib-auth/auth-client.h
--- a/src/lib-auth/auth-client.h	Fri Nov 18 16:15:24 2011 +0200
+++ b/src/lib-auth/auth-client.h	Fri Nov 18 16:16:34 2011 +0200
@@ -15,6 +15,8 @@
 };
 
 enum auth_request_status {
+	AUTH_REQUEST_STATUS_ABORT = -3,
+	AUTH_REQUEST_STATUS_INTERNAL_FAIL = -2,
 	AUTH_REQUEST_STATUS_FAIL = -1,
 	AUTH_REQUEST_STATUS_CONTINUE,
 	AUTH_REQUEST_STATUS_OK
diff -r 2ecd0e90402a -r dd66ea0e7d00 src/lib-auth/auth-server-connection.c
--- a/src/lib-auth/auth-server-connection.c	Fri Nov 18 16:15:24 2011 +0200
+++ b/src/lib-auth/auth-server-connection.c	Fri Nov 18 16:16:34 2011 +0200
@@ -243,6 +243,7 @@
 		return;
 	case -1:
 		/* disconnected */
+		i_error("Authentication server disconnected, reconnecting");
 		auth_server_connection_reconnect(conn);
 		return;
 	case -2:
@@ -314,8 +315,8 @@
 		struct auth_client_request *request = value;
 
 		auth_client_request_server_input(request,
-						 AUTH_REQUEST_STATUS_FAIL,
-						 temp_failure_args);
+			AUTH_REQUEST_STATUS_INTERNAL_FAIL,
+			temp_failure_args);
 	}
 	hash_table_iterate_deinit(&iter);
 	hash_table_clear(conn->requests, FALSE);
diff -r 2ecd0e90402a -r dd66ea0e7d00 src/login-common/client-common.c
--- a/src/login-common/client-common.c	Fri Nov 18 16:15:24 2011 +0200
+++ b/src/login-common/client-common.c	Fri Nov 18 16:16:34 2011 +0200
@@ -539,6 +539,8 @@
 	}
 	if (client->auth_try_aborted && client->auth_attempts == 1)
 		return "(aborted authentication)";
+	if (client->auth_process_comm_fail)
+		return "(auth process communication failure)";
 
 	if (client->auth_successes > 0) {
 		return t_strdup_printf("(internal failure, %u succesful auths)",
diff -r 2ecd0e90402a -r dd66ea0e7d00 src/login-common/client-common.h
--- a/src/login-common/client-common.h	Fri Nov 18 16:15:24 2011 +0200
+++ b/src/login-common/client-common.h	Fri Nov 18 16:16:34 2011 +0200
@@ -125,6 +125,7 @@
 	unsigned int auth_tried_unsupported_mech:1;
 	unsigned int auth_try_aborted:1;
 	unsigned int auth_initializing:1;
+	unsigned int auth_process_comm_fail:1;
 	/* ... */
 };
 
diff -r 2ecd0e90402a -r dd66ea0e7d00 src/login-common/sasl-server.c
--- a/src/login-common/sasl-server.c	Fri Nov 18 16:15:24 2011 +0200
+++ b/src/login-common/sasl-server.c	Fri Nov 18 16:16:34 2011 +0200
@@ -245,7 +245,11 @@
 			anvil_check_too_many_connections(client, request);
 		}
 		break;
+	case AUTH_REQUEST_STATUS_INTERNAL_FAIL:
+		client->auth_process_comm_fail = TRUE;
+		/* fall through */
 	case AUTH_REQUEST_STATUS_FAIL:
+	case AUTH_REQUEST_STATUS_ABORT:
 		client->auth_request = NULL;
 
 		if (args != NULL) {


More information about the dovecot-cvs mailing list