dovecot-1.1: imap/pop3-proxy: If auth_verbose=yes, log proxy log...

dovecot at dovecot.org dovecot at dovecot.org
Sat Aug 30 12:35:03 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/f42c9561421b
changeset: 7843:f42c9561421b
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Aug 30 12:34:58 2008 +0300
description:
imap/pop3-proxy: If auth_verbose=yes, log proxy login failures.

diffstat:

2 files changed, 40 insertions(+)
src/imap-login/imap-proxy.c |   20 ++++++++++++++++++++
src/pop3-login/pop3-proxy.c |   20 ++++++++++++++++++++

diffs (60 lines):

diff -r 0177096cefe5 -r f42c9561421b src/imap-login/imap-proxy.c
--- a/src/imap-login/imap-proxy.c	Sat Aug 30 11:59:50 2008 +0300
+++ b/src/imap-login/imap-proxy.c	Sat Aug 30 12:34:58 2008 +0300
@@ -90,6 +90,26 @@ static int proxy_input_line(struct imap_
 		   be using only Dovecot as their backend :) */
 		client_send_tagline(client, line + 2);
 
+		if (verbose_auth) {
+			str = t_str_new(128);
+			str_printfa(str, "proxy(%s): Login failed to %s:%u",
+				    client->common.virtual_user,
+				    login_proxy_get_host(client->proxy),
+				    login_proxy_get_port(client->proxy));
+			if (strcmp(client->common.virtual_user,
+				   client->proxy_user) != 0) {
+				/* remote username is different, log it */
+				str_append_c(str, '/');
+				str_append(str, client->proxy_user);
+			}
+			str_append(str, ": ");
+			if (strncasecmp(line + 2, "NO ", 3) == 0)
+				str_append(str, line + 2 + 3);
+			else
+				str_append(str, line + 2);
+			i_info("%s", str_c(str));
+		}
+
 		/* allow client input again */
 		i_assert(client->io == NULL);
 		client->io = io_add(client->common.fd, IO_READ,
diff -r 0177096cefe5 -r f42c9561421b src/pop3-login/pop3-proxy.c
--- a/src/pop3-login/pop3-proxy.c	Sat Aug 30 11:59:50 2008 +0300
+++ b/src/pop3-login/pop3-proxy.c	Sat Aug 30 12:34:58 2008 +0300
@@ -132,6 +132,26 @@ static void proxy_input(struct istream *
 	else
 		client_send_line(client, line);
 
+	if (verbose_auth) {
+		str = t_str_new(128);
+		str_printfa(str, "proxy(%s): Login failed to %s:%u",
+			    client->common.virtual_user,
+			    login_proxy_get_host(client->proxy),
+			    login_proxy_get_port(client->proxy));
+		if (strcmp(client->common.virtual_user,
+			   client->proxy_user) != 0) {
+			/* remote username is different, log it */
+			str_append_c(str, '/');
+			str_append(str, client->proxy_user);
+		}
+		str_append(str, ": ");
+		if (strncmp(line, "-ERR ", 5) == 0)
+			str_append(str, line + 5);
+		else
+			str_append(str, line);
+		i_info("%s", str_c(str));
+	}
+
 	/* allow client input again */
 	i_assert(client->io == NULL);
 	client->io = io_add(client->common.fd, IO_READ,


More information about the dovecot-cvs mailing list