On Wed, 2011-11-16 at 15:00 +0100, Bambero wrote:
> >> Nov 12 05:11:15 myhost exim[23366]: 2011-11-12 05:11:15 SMTP protocol
> >> synchronization error (next input sent too soon: pipelining was not
> >> advertised): rejected "EHLO myhost" H=localhost [127.0.0.1] next
> >> input="MAIL FROM:<root@myhost>\\r\\n"
> >
> > This basically says that Dovecot's SMTP client is being noncompliant,
> > because Exim doesn't advertise PIPELINING extension. But I'd rather not
> > add more code to fix this, since PIPELINING gives you a little bit
> > better performance anyway and you can most likely fix this by modifying
> > Exim's configs in some way (I can't believe Exim wouldn't support
> > PIPENING..).
> >
> >
> Thanks for your reply.
> Indeed exim supports PIPELINING by default:

Oh. Well, see if the attached patch helps? If it does, I'll add it to
next version.

diff -r 5fefb7f1e6c4 src/lib-lda/lmtp-client.c
--- a/src/lib-lda/lmtp-client.c	Wed Nov 16 00:28:32 2011 +0200
+++ b/src/lib-lda/lmtp-client.c	Wed Nov 16 16:36:56 2011 +0200
@@ -330,7 +330,6 @@
 
 static void lmtp_client_send_handshake(struct lmtp_client *client)
 {
-	o_stream_cork(client->output);
 	switch (client->protocol) {
 	case LMTP_CLIENT_PROTOCOL_LMTP:
 		o_stream_send_str(client->output,
@@ -343,9 +342,6 @@
 					client->set.my_hostname));
 		break;
 	}
-	o_stream_send_str(client->output,
-		t_strdup_printf("MAIL FROM:%s\r\n", client->set.mail_from));
-	o_stream_uncork(client->output);
 }
 
 static int lmtp_input_get_reply_code(const char *line, int *reply_code_r)
@@ -395,6 +391,11 @@
 			lmtp_client_fail(client, line);
 			return -1;
 		}
+		if (client->input_state == LMTP_INPUT_STATE_LHLO) {
+			o_stream_send_str(client->output,
+				t_strdup_printf("MAIL FROM:%s\r\n",
+						client->set.mail_from));
+		}
 		client->input_state++;
 		lmtp_client_send_rcpts(client);
 		break;
@@ -432,8 +433,10 @@
 	const char *line;
 
 	lmtp_client_ref(client);
+	o_stream_cork(client->output);
 	while ((line = i_stream_read_next_line(client->input)) != NULL) {
 		if (lmtp_client_input_line(client, line) < 0) {
+			o_stream_uncork(client->output);
 			lmtp_client_unref(&client);
 			return;
 		}
@@ -448,6 +451,7 @@
 		lmtp_client_fail(client, ERRSTR_TEMP_REMOTE_FAILURE
 				 " (disconnected in input)");
 	}
+	o_stream_uncork(client->output);
 	lmtp_client_unref(&client);
 }
 

Reply via email to