dovecot-2.1: login: Added logging if auth process doesn't respon...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jan 12 21:53:44 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/957e74f0d60f
changeset: 13933:957e74f0d60f
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jan 12 21:53:31 2012 +0200
description:
login: Added logging if auth process doesn't respond fast enough for greeting.

diffstat:

 src/login-common/client-common-auth.c |   9 ++++++++-
 src/login-common/client-common.c      |  12 ++++++++++++
 src/login-common/client-common.h      |   1 +
 3 files changed, 21 insertions(+), 1 deletions(-)

diffs (73 lines):

diff -r 1c77891b754b -r 957e74f0d60f src/login-common/client-common-auth.c
--- a/src/login-common/client-common-auth.c	Thu Jan 12 15:40:30 2012 +0200
+++ b/src/login-common/client-common-auth.c	Thu Jan 12 21:53:31 2012 +0200
@@ -17,6 +17,7 @@
 /* If we've been waiting auth server to respond for over this many milliseconds,
    send a "waiting" message. */
 #define AUTH_WAITING_TIMEOUT_MSECS (30*1000)
+#define GREETING_WARNING_TIMEOUT_MSECS (10*1000)
 
 #define CLIENT_AUTH_BUF_MAX_SIZE 8192
 
@@ -36,6 +37,10 @@
 
 static void client_auth_waiting_timeout(struct client *client)
 {
+	if (!client->greeting_sent) {
+		client_log_warn(client, "Auth process not responding, "
+				"delayed sending greeting");
+	}
 	client_send_line(client, CLIENT_CMD_REPLY_STATUS,
 			 client->master_tag == 0 ?
 			 AUTH_SERVER_WAITING_MSG : AUTH_MASTER_WAITING_MSG);
@@ -46,7 +51,9 @@
 {
 	i_assert(client->to_auth_waiting == NULL);
 	client->to_auth_waiting =
-		timeout_add(AUTH_WAITING_TIMEOUT_MSECS,
+		timeout_add(!client->greeting_sent ?
+			    GREETING_WARNING_TIMEOUT_MSECS :
+			    AUTH_WAITING_TIMEOUT_MSECS,
 			    client_auth_waiting_timeout, client);
 }
 
diff -r 1c77891b754b -r 957e74f0d60f src/login-common/client-common.c
--- a/src/login-common/client-common.c	Thu Jan 12 15:40:30 2012 +0200
+++ b/src/login-common/client-common.c	Thu Jan 12 21:53:31 2012 +0200
@@ -484,6 +484,13 @@
 	} T_END;
 }
 
+void client_log_warn(struct client *client, const char *msg)
+{
+	T_BEGIN {
+		i_warning("%s", client_get_log_str(client, msg));
+	} T_END;
+}
+
 bool client_is_trusted(struct client *client)
 {
 	const char *const *net;
@@ -520,6 +527,11 @@
 			return "(client didn't send a cert)";
 	}
 
+	if (!client->greeting_sent)
+		return t_strdup_printf(
+			"(disconnected before greeting, waited %u secs)",
+			(unsigned int)(ioloop_time - client->created));
+
 	if (client->auth_attempts == 0) {
 		return t_strdup_printf("(no auth attempts in %u secs)",
 			(unsigned int)(ioloop_time - client->created));
diff -r 1c77891b754b -r 957e74f0d60f src/login-common/client-common.h
--- a/src/login-common/client-common.h	Thu Jan 12 15:40:30 2012 +0200
+++ b/src/login-common/client-common.h	Thu Jan 12 21:53:31 2012 +0200
@@ -152,6 +152,7 @@
 void client_set_title(struct client *client);
 void client_log(struct client *client, const char *msg);
 void client_log_err(struct client *client, const char *msg);
+void client_log_warn(struct client *client, const char *msg);
 const char *client_get_extra_disconnect_reason(struct client *client);
 bool client_is_trusted(struct client *client);
 void client_auth_failed(struct client *client);


More information about the dovecot-cvs mailing list