dovecot-2.2: lmtp: Log a bit nicer message when client QUITs.
    dovecot at dovecot.org 
    dovecot at dovecot.org
       
    Sun Feb 24 18:19:52 EET 2013
    
    
  
details:   http://hg.dovecot.org/dovecot-2.2/rev/df3da60fa137
changeset: 15920:df3da60fa137
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 24 18:19:40 2013 +0200
description:
lmtp: Log a bit nicer message when client QUITs.
I did think about removing the connect and successful disconnect messages
entirely, but these may be useful when debugging problems with MTA.
diffstat:
 src/lmtp/client.c   |  2 +-
 src/lmtp/client.h   |  1 +
 src/lmtp/commands.c |  6 +++++-
 3 files changed, 7 insertions(+), 2 deletions(-)
diffs (39 lines):
diff -r f5fb1ca222e3 -r df3da60fa137 src/lmtp/client.c
--- a/src/lmtp/client.c	Sun Feb 24 18:02:25 2013 +0200
+++ b/src/lmtp/client.c	Sun Feb 24 18:19:40 2013 +0200
@@ -190,7 +190,7 @@
 	client->state.session_id = p_strdup(client->state_pool, str_c(id));
 }
 
-static const char *client_remote_id(struct client *client)
+const char *client_remote_id(struct client *client)
 {
 	const char *addr;
 
diff -r f5fb1ca222e3 -r df3da60fa137 src/lmtp/client.h
--- a/src/lmtp/client.h	Sun Feb 24 18:02:25 2013 +0200
+++ b/src/lmtp/client.h	Sun Feb 24 18:19:40 2013 +0200
@@ -80,6 +80,7 @@
 void client_io_reset(struct client *client);
 void client_state_reset(struct client *client);
 void client_state_set(struct client *client, const char *name);
+const char *client_remote_id(struct client *client);
 
 void client_input_handle(struct client *client);
 int client_input_read(struct client *client);
diff -r f5fb1ca222e3 -r df3da60fa137 src/lmtp/commands.c
--- a/src/lmtp/commands.c	Sun Feb 24 18:02:25 2013 +0200
+++ b/src/lmtp/commands.c	Sun Feb 24 18:19:40 2013 +0200
@@ -585,7 +585,11 @@
 
 int cmd_quit(struct client *client, const char *args ATTR_UNUSED)
 {
-	client_destroy(client, "221 2.0.0", "Client quit");
+	client_send_line(client, "221 2.0.0 OK");
+	/* don't log the (state name) for successful QUITs */
+	i_info("Disconnect from %s: Successful quit", client_remote_id(client));
+	client->disconnected = TRUE;
+	client_destroy(client, NULL, NULL);
 	return -1;
 }
 
    
    
More information about the dovecot-cvs
mailing list