dovecot-2.1: login: If auth client disconnects without having ev...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Feb 15 05:12:39 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/4462ceb09c0d
changeset: 14152:4462ceb09c0d
user: Timo Sirainen <tss at iki.fi>
date: Wed Feb 15 05:12:14 2012 +0200
description:
login: If auth client disconnects without having ever succeeded, destroy clients.
diffstat:
src/login-common/client-common.c | 9 +++++++--
src/login-common/client-common.h | 1 +
src/login-common/main.c | 12 ++++++++++--
3 files changed, 18 insertions(+), 4 deletions(-)
diffs (68 lines):
diff -r 5ac4a8c8545f -r 4462ceb09c0d src/login-common/client-common.c
--- a/src/login-common/client-common.c Wed Feb 15 04:32:14 2012 +0200
+++ b/src/login-common/client-common.c Wed Feb 15 05:12:14 2012 +0200
@@ -244,16 +244,21 @@
client_destroy(client, "Disconnected: Connection queue full");
}
-void clients_destroy_all(void)
+void clients_destroy_all_reason(const char *reason)
{
struct client *client, *next;
for (client = clients; client != NULL; client = next) {
next = client->next;
- client_destroy(client, "Disconnected: Shutting down");
+ client_destroy(client, reason);
}
}
+void clients_destroy_all(void)
+{
+ clients_destroy_all_reason("Disconnected: Shutting down");
+}
+
static void client_start_tls(struct client *client)
{
int fd_ssl;
diff -r 5ac4a8c8545f -r 4462ceb09c0d src/login-common/client-common.h
--- a/src/login-common/client-common.h Wed Feb 15 04:32:14 2012 +0200
+++ b/src/login-common/client-common.h Wed Feb 15 05:12:14 2012 +0200
@@ -187,5 +187,6 @@
void clients_notify_auth_connected(void);
void client_destroy_oldest(void);
void clients_destroy_all(void);
+void clients_destroy_all_reason(const char *reason);
#endif
diff -r 5ac4a8c8545f -r 4462ceb09c0d src/login-common/main.c
--- a/src/login-common/main.c Wed Feb 15 04:32:14 2012 +0200
+++ b/src/login-common/main.c Wed Feb 15 05:12:14 2012 +0200
@@ -45,6 +45,7 @@
static struct timeout *auth_client_to;
static bool shutting_down = FALSE;
static bool ssl_connections = FALSE;
+static bool auth_connected_once = FALSE;
static void login_access_lookup_next(struct login_access_lookup *lookup);
@@ -246,10 +247,17 @@
static void auth_connect_notify(struct auth_client *client ATTR_UNUSED,
bool connected, void *context ATTR_UNUSED)
{
- if (connected)
+ if (connected) {
+ auth_connected_once = TRUE;
clients_notify_auth_connected();
- else if (shutting_down)
+ } else if (shutting_down)
clients_destroy_all();
+ else if (!auth_connected_once) {
+ /* auth disconnected without having ever succeeded, so the
+ auth process is probably misconfigured. no point in
+ keeping the client connections hanging. */
+ clients_destroy_all_reason("Disconnected: Auth process broken");
+ }
}
static bool anvil_reconnect_callback(void)
More information about the dovecot-cvs
mailing list