changeset 5046:f2cc68a3a198 HEAD

Log the proxy destination host:port.
author Timo Sirainen <tss@iki.fi>
date Fri, 19 Jan 2007 23:19:49 +0200
parents 151fb7a170c5
children e92b4ad15b70
files src/imap-login/imap-proxy.c src/pop3-login/pop3-proxy.c
diffstat 2 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap-login/imap-proxy.c	Fri Jan 19 23:07:19 2007 +0200
+++ b/src/imap-login/imap-proxy.c	Fri Jan 19 23:19:49 2007 +0200
@@ -14,6 +14,7 @@
 			    struct ostream *output, const char *line)
 {
 	string_t *str;
+	const char *msg;
 
 	i_assert(!client->destroyed);
 
@@ -48,6 +49,11 @@
 		(void)o_stream_send_str(client->output, line + 1);
 		(void)o_stream_send(client->output, "\r\n", 2);
 
+		msg = t_strdup_printf("proxy(%s): started proxying to %s:%u",
+				      client->common.virtual_user,
+				      login_proxy_get_host(client->proxy),
+				      login_proxy_get_port(client->proxy));
+
 		(void)client_skip_line(client);
 		login_proxy_detach(client->proxy, client->input,
 				   client->output);
@@ -56,8 +62,7 @@
 		client->input = NULL;
 		client->output = NULL;
 		client->common.fd = -1;
-		client_destroy(client, t_strdup_printf("proxy(%s): started",
-						client->common.virtual_user));
+		client_destroy(client, msg);
 		return -1;
 	} else if (strncmp(line, "P ", 2) == 0) {
 		/* Login failed. Send our own failure reply so client can't
--- a/src/pop3-login/pop3-proxy.c	Fri Jan 19 23:07:19 2007 +0200
+++ b/src/pop3-login/pop3-proxy.c	Fri Jan 19 23:19:49 2007 +0200
@@ -14,7 +14,7 @@
 			struct pop3_client *client)
 {
 	string_t *str;
-	const char *line;
+	const char *line, *msg;
 
 	i_assert(!client->destroyed);
 
@@ -96,6 +96,11 @@
 		(void)o_stream_send_str(client->output, line);
 		(void)o_stream_send(client->output, "\r\n", 2);
 
+		msg = t_strdup_printf("proxy(%s): started proxying to %s:%u",
+				      client->common.virtual_user,
+				      login_proxy_get_host(client->proxy),
+				      login_proxy_get_port(client->proxy));
+
 		login_proxy_detach(client->proxy, client->input,
 				   client->output);
 
@@ -103,9 +108,7 @@
 		client->input = NULL;
 		client->output = NULL;
 		client->common.fd = -1;
-		client_destroy(client,
-			       t_strdup_printf("proxy(%s): started",
-					       client->common.virtual_user));
+		client_destroy(client, msg);
 		return;
 	}