Hi,

We are running Dovecot proxies in front of our Dovecot IMAP servers, and were 
having problems with Windows Mobile clients not being able to connect. The 
clients would send a LOGIN command, and immediately after the succes reply a 
LOGOUT command.

It turns out the Windows Mobile IMAP client gets confused by the IMAP proxy 
first sending the command tag in the reply and then, in a seperate packet, the 
rest of the line. Although not being able to handle this looks like a very bad 
design to me (how can one ever expect to read a full line in a single read() 
call?) I fixed it in our Dovecot proxies because we do have clients that want 
to use it.

Attached is my fix for the problem.

Onno
diff -ru dovecot-1.0.13.orig/src/imap-login/imap-proxy.c dovecot-1.0.13/src/imap-login/imap-proxy.c
--- dovecot-1.0.13.orig/src/imap-login/imap-proxy.c	2007-12-11 19:52:08.000000000 +0100
+++ dovecot-1.0.13/src/imap-login/imap-proxy.c	2008-04-22 11:11:13.000000000 +0200
@@ -45,9 +45,11 @@
 		return 0;
 	} else if (strncmp(line, "P OK ", 5) == 0) {
 		/* Login successful. Send this line to client. */
-		(void)o_stream_send_str(client->output, client->cmd_tag);
-		(void)o_stream_send_str(client->output, line + 1);
-		(void)o_stream_send(client->output, "\r\n", 2);
+		str = t_str_new(128);
+		str_append(str, client->cmd_tag);
+		str_append(str, line + 1);
+		str_append(str, "\r\n");
+		(void)o_stream_send_str(client->output, str_data(str));
 
 		msg = t_strdup_printf("proxy(%s): started proxying to %s:%u",
 				      client->common.virtual_user,

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to