dovecot-2.2: lib-lda: lmtp_client_connect_tcp() shouldn't immedi...

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 11 20:03:21 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/086c75564ba0
changeset: 16845:086c75564ba0
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Oct 11 20:03:06 2013 +0300
description:
lib-lda: lmtp_client_connect_tcp() shouldn't immediately call callbacks if dns lookup fails.

diffstat:

 src/lib-lda/lmtp-client.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 2e23267dff66 -r 086c75564ba0 src/lib-lda/lmtp-client.c
--- a/src/lib-lda/lmtp-client.c	Fri Oct 11 19:27:39 2013 +0300
+++ b/src/lib-lda/lmtp-client.c	Fri Oct 11 20:03:06 2013 +0300
@@ -69,6 +69,7 @@
 	struct istream *data_input;
 	unsigned char output_last;
 
+	unsigned int running:1;
 	unsigned int xclient_sent:1;
 	unsigned int rcpt_to_successes:1;
 	unsigned int output_finished:1;
@@ -617,11 +618,13 @@
 	if (result->ret != 0) {
 		i_error("lmtp client: DNS lookup of %s failed: %s",
 			client->host, result->error);
-		lmtp_client_fail(client, ERRSTR_TEMP_REMOTE_FAILURE
-				 " (DNS lookup)");
+		if (client->running) {
+			lmtp_client_fail(client, ERRSTR_TEMP_REMOTE_FAILURE
+					 " (DNS lookup)");
+		}
 	} else {
 		client->ip = result->ips[0];
-		if (lmtp_client_connect(client) < 0) {
+		if (lmtp_client_connect(client) < 0 && client->running) {
 			lmtp_client_fail(client, ERRSTR_TEMP_REMOTE_FAILURE
 					 " (connect)");
 		}
@@ -668,6 +671,7 @@
 			       lmtp_client_dns_done, client,
 			       &client->dns_lookup) < 0)
 			return -1;
+		client->running = TRUE;
 		return 0;
 	}
 


More information about the dovecot-cvs mailing list