dovecot-2.0: lmtp/smtp client: Crashfix if remote returned failu...

dovecot at dovecot.org dovecot at dovecot.org
Mon Mar 21 18:51:54 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/31b3f1819c89
changeset: 12692:31b3f1819c89
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Mar 21 18:51:51 2011 +0200
description:
lmtp/smtp client: Crashfix if remote returned failure to RCPT TO.

diffstat:

 src/lib-lda/lmtp-client.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r 3d48418b0501 -r 31b3f1819c89 src/lib-lda/lmtp-client.c
--- a/src/lib-lda/lmtp-client.c	Thu Mar 17 19:02:26 2011 +0200
+++ b/src/lib-lda/lmtp-client.c	Mon Mar 21 18:51:51 2011 +0200
@@ -206,16 +206,18 @@
 	rcpt->rcpt_to_callback(success, line, rcpt->context);
 }
 
-static void lmtp_client_send_data_cmd(struct lmtp_client *client)
+static int lmtp_client_send_data_cmd(struct lmtp_client *client)
 {
 	if (client->rcpt_next_receive_idx < array_count(&client->recipients))
-		return;
+		return 0;
 
-	if (client->global_fail_string != NULL || !client->rcpt_to_successes)
+	if (client->global_fail_string != NULL || !client->rcpt_to_successes) {
 		lmtp_client_fail(client, client->global_fail_string);
-	else {
+		return -1;
+	} else {
 		client->input_state++;
 		o_stream_send_str(client->output, "DATA\r\n");
+		return 0;
 	}
 }
 
@@ -390,7 +392,8 @@
 		lmtp_client_rcpt_next(client, line);
 		if (client->data_input == NULL)
 			break;
-		lmtp_client_send_data_cmd(client);
+		if (lmtp_client_send_data_cmd(client) < 0)
+			return -1;
 		break;
 	case LMTP_INPUT_STATE_DATA_CONTINUE:
 		/* Start sending DATA */
@@ -584,7 +587,7 @@
 	i_stream_ref(data_input);
 	client->data_input = data_input;
 
-	lmtp_client_send_data_cmd(client);
+	(void)lmtp_client_send_data_cmd(client);
 }
 
 void lmtp_client_send_more(struct lmtp_client *client)


More information about the dovecot-cvs mailing list