dovecot-2.1: pop3 proxy: Fixed handling XCLIENT reply.

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 25 06:39:24 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/ef7518f0bdbc
changeset: 14194:ef7518f0bdbc
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Feb 25 06:39:00 2012 +0200
description:
pop3 proxy: Fixed handling XCLIENT reply.

diffstat:

 src/pop3-login/client.h     |   1 +
 src/pop3-login/pop3-proxy.c |  14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diffs (49 lines):

diff -r d84a9950be67 -r ef7518f0bdbc src/pop3-login/client.h
--- a/src/pop3-login/client.h	Sat Feb 25 05:42:05 2012 +0200
+++ b/src/pop3-login/client.h	Sat Feb 25 06:39:00 2012 +0200
@@ -8,6 +8,7 @@
 enum pop3_proxy_state {
 	POP3_PROXY_BANNER = 0,
 	POP3_PROXY_STARTTLS,
+	POP3_PROXY_XCLIENT,
 	POP3_PROXY_LOGIN1,
 	POP3_PROXY_LOGIN2
 };
diff -r d84a9950be67 -r ef7518f0bdbc src/pop3-login/pop3-proxy.c
--- a/src/pop3-login/pop3-proxy.c	Sat Feb 25 05:42:05 2012 +0200
+++ b/src/pop3-login/pop3-proxy.c	Sat Feb 25 06:39:00 2012 +0200
@@ -43,6 +43,9 @@
 			"XCLIENT ADDR=%s PORT=%u\r\n",
 			net_ip2addr(&client->common.ip),
 			client->common.remote_port));
+		client->common.proxy_state = POP3_PROXY_XCLIENT;
+	} else {
+		client->common.proxy_state = POP3_PROXY_LOGIN1;
 	}
 
 	str = t_str_new(128);
@@ -56,7 +59,6 @@
 		str_append(str, "AUTH PLAIN\r\n");
 	}
 	(void)o_stream_send(output, str_data(str), str_len(str));
-	client->common.proxy_state = POP3_PROXY_LOGIN1;
 }
 
 int pop3_proxy_parse_line(struct client *client, const char *line)
@@ -106,6 +108,16 @@
 		output = login_proxy_get_ostream(client->login_proxy);
 		proxy_send_login(pop3_client, output);
 		return 1;
+	case POP3_PROXY_XCLIENT:
+		if (strncmp(line, "+OK", 3) != 0) {
+			client_log_err(client, t_strdup_printf(
+				"proxy: Remote XCLIENT failed: %s",
+				str_sanitize(line, 160)));
+			client_proxy_failed(client, TRUE);
+			return -1;
+		}
+		client->proxy_state = POP3_PROXY_LOGIN1;
+		return 1;
 	case POP3_PROXY_LOGIN1:
 		str = t_str_new(128);
 		if (client->proxy_master_user == NULL) {


More information about the dovecot-cvs mailing list