dovecot-2.0: lib-lda: Don't send MAIL FROM to LMTP/SMTP server b...

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 16 22:14:41 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/ac5e9e70ca6b
changeset: 12974:ac5e9e70ca6b
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Nov 16 22:14:35 2011 +0200
description:
lib-lda: Don't send MAIL FROM to LMTP/SMTP server before it replied to LHLO/EHLO.

diffstat:

 src/lib-lda/lmtp-client.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r 629629e65d83 -r ac5e9e70ca6b src/lib-lda/lmtp-client.c
--- a/src/lib-lda/lmtp-client.c	Wed Nov 16 22:13:35 2011 +0200
+++ b/src/lib-lda/lmtp-client.c	Wed Nov 16 22:14:35 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);
 }
 


More information about the dovecot-cvs mailing list