dovecot-2.0: lmtp: Log the current state in disconnect message.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jun 30 08:27:40 EEST 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/1b1fc681a277
changeset: 12864:1b1fc681a277
user: Timo Sirainen <tss at iki.fi>
date: Thu Jun 30 08:27:32 2011 +0300
description:
lmtp: Log the current state in disconnect message.
diffstat:
src/lmtp/client.c | 5 ++++-
src/lmtp/client.h | 1 +
src/lmtp/commands.c | 6 ++++++
3 files changed, 11 insertions(+), 1 deletions(-)
diffs (83 lines):
diff -r 1d78d2a4e8d1 -r 1b1fc681a277 src/lmtp/client.c
--- a/src/lmtp/client.c Thu Jun 30 08:00:07 2011 +0300
+++ b/src/lmtp/client.c Thu Jun 30 08:27:32 2011 +0300
@@ -226,6 +226,7 @@
client_io_reset(client);
client->state_pool = pool_alloconly_create("client state", 4096);
client->state.mail_data_fd = -1;
+ client->state.name = "banner";
client_read_settings(client);
client_raw_user_create(client);
client_generate_session_id(client);
@@ -290,7 +291,8 @@
client_send_line(client, "%s %s", prefix, reason);
else
reason = client_get_disconnect_reason(client);
- i_info("Disconnect from %s: %s", client_remote_id(client), reason);
+ i_info("Disconnect from %s: %s (in %s)", client_remote_id(client),
+ reason, client->state.name);
client->disconnected = TRUE;
}
@@ -325,6 +327,7 @@
client->state.mail_data_fd = -1;
client_generate_session_id(client);
+ client->state.name = "reset";
}
void client_send_line(struct client *client, const char *fmt, ...)
diff -r 1d78d2a4e8d1 -r 1b1fc681a277 src/lmtp/client.h
--- a/src/lmtp/client.h Thu Jun 30 08:00:07 2011 +0300
+++ b/src/lmtp/client.h Thu Jun 30 08:27:32 2011 +0300
@@ -12,6 +12,7 @@
};
struct client_state {
+ const char *name;
const char *session_id;
const char *mail_from;
ARRAY_DEFINE(rcpt_to, struct mail_recipient);
diff -r 1d78d2a4e8d1 -r 1b1fc681a277 src/lmtp/commands.c
--- a/src/lmtp/commands.c Thu Jun 30 08:00:07 2011 +0300
+++ b/src/lmtp/commands.c Thu Jun 30 08:27:32 2011 +0300
@@ -73,6 +73,7 @@
i_free(client->lhlo);
client->lhlo = i_strdup(str_c(domain));
+ client->state.name = "LHLO";
return 0;
}
@@ -141,6 +142,7 @@
client->state.mail_from = p_strdup(client->state_pool, addr);
p_array_init(&client->state.rcpt_to, client->state_pool, 64);
client_send_line(client, "250 2.1.0 OK");
+ client->state.name = "MAIL FROM";
return 0;
}
@@ -385,6 +387,8 @@
const char *error = NULL;
int ret = 0;
+ client->state.name = "RCPT TO";
+
if (client->state.mail_from == NULL) {
client_send_line(client, "503 5.5.1 MAIL needed first");
return 0;
@@ -897,12 +901,14 @@
io_remove(&client->io);
if (array_count(&client->state.rcpt_to) == 0) {
+ client->state.name = "DATA (proxy)";
timeout_remove(&client->to_idle);
lmtp_proxy_start(client->proxy, client->dot_input,
client->state.added_headers,
client_proxy_finish, client);
i_stream_unref(&client->dot_input);
} else {
+ client->state.name = "DATA";
client->io = io_add(client->fd_in, IO_READ,
client_input_data, client);
client_input_data_handle(client);
More information about the dovecot-cvs
mailing list