Mercurial > dovecot > core-2.2
changeset 20740:96915258dd31
lib-lda: Cleanup error handling in LMTP client code.
If there are no successful recipients, we'll need to deinit the client.
But at that point we've already called all the callbacks, so the line
parameter to lmtp_client_fail_full() isn't actually used anywhere.
This was confusing static analyzer because global_fail_string was used
as parameter, which could have been NULL and wouldn't have been valid
for the callbacks.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Sat, 10 Sep 2016 11:28:38 +0300 |
parents | 607dad4f8c4c |
children | 806511128f8c |
files | src/lib-lda/lmtp-client.c |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-lda/lmtp-client.c Sat Sep 10 11:16:05 2016 +0300 +++ b/src/lib-lda/lmtp-client.c Sat Sep 10 11:28:38 2016 +0300 @@ -274,10 +274,14 @@ if (client->rcpt_next_receive_idx < array_count(&client->recipients)) return 0; - if (client->global_fail_string != NULL || !client->rcpt_to_successes) { + if (client->global_fail_string != NULL) { lmtp_client_fail_full(client, client->global_fail_string, client->global_remote_failure); return -1; + } else if (!client->rcpt_to_successes) { + /* This error string shouldn't become visible anywhere */ + lmtp_client_fail_full(client, "No valid recipients", FALSE); + return -1; } else { client->input_state++; o_stream_nsend_str(client->output, "DATA\r\n");