dovecot-2.0: auth: If we get disconnected from anvil and can't r...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Nov 18 22:35:42 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/3e4a65a74c40
changeset: 12449:3e4a65a74c40
user: Timo Sirainen <tss at iki.fi>
date: Thu Nov 18 20:35:39 2010 +0000
description:
auth: If we get disconnected from anvil and can't reconnect, die.
diffstat:
src/auth/auth-penalty.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diffs (41 lines):
diff -r 9a9f65bcbe19 -r 3e4a65a74c40 src/auth/auth-penalty.c
--- a/src/auth/auth-penalty.c Thu Nov 18 20:35:20 2010 +0000
+++ b/src/auth/auth-penalty.c Thu Nov 18 20:35:39 2010 +0000
@@ -4,6 +4,7 @@
#include "ioloop.h"
#include "network.h"
#include "crc32.h"
+#include "master-service.h"
#include "anvil-client.h"
#include "auth-request.h"
#include "auth-penalty.h"
@@ -16,6 +17,7 @@
struct auth_penalty_request {
struct auth_request *auth_request;
+ struct anvil_client *client;
auth_penalty_callback_t *callback;
};
@@ -67,7 +69,12 @@
unsigned int secs, drop_penalty;
if (reply == NULL) {
- /* internal failure */
+ /* internal failure. */
+ if (!anvil_client_is_connected(request->client)) {
+ /* we probably didn't have permissions to reconnect
+ back to anvil. need to restart ourself. */
+ master_service_stop(master_service);
+ }
} else if (sscanf(reply, "%u %lu", &penalty, &last_penalty) != 2) {
i_error("Invalid PENALTY-GET reply: %s", reply);
} else {
@@ -123,6 +130,7 @@
request = i_new(struct auth_penalty_request, 1);
request->auth_request = auth_request;
+ request->client = penalty->client;
request->callback = callback;
auth_request_ref(auth_request);
More information about the dovecot-cvs
mailing list