Mercurial > dovecot > core-2.2
changeset 12899:31b3f1819c89
lmtp/smtp client: Crashfix if remote returned failure to RCPT TO.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 21 Mar 2011 18:51:51 +0200 |
parents | 3d48418b0501 |
children | 0dcbd2357451 |
files | src/lib-lda/lmtp-client.c |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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)