dovecot-2.2: pop3c: Don't assert-crash if we can't do DNS lookup.

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 12 21:16:16 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/7057dfeaeb1a
changeset: 16496:7057dfeaeb1a
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 12 21:16:06 2013 +0300
description:
pop3c: Don't assert-crash if we can't do DNS lookup.

diffstat:

 src/lib-storage/index/pop3c/pop3c-client.c |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (40 lines):

diff -r d447dcc6b611 -r 7057dfeaeb1a src/lib-storage/index/pop3c/pop3c-client.c
--- a/src/lib-storage/index/pop3c/pop3c-client.c	Wed Jun 12 16:43:41 2013 +0300
+++ b/src/lib-storage/index/pop3c/pop3c-client.c	Wed Jun 12 21:16:06 2013 +0300
@@ -199,7 +199,7 @@
 void pop3c_client_run(struct pop3c_client *client)
 {
 	struct ioloop *ioloop, *prev_ioloop = current_ioloop;
-	bool timeout_added = FALSE;
+	bool timeout_added = FALSE, failed = FALSE;
 
 	i_assert(client->fd != -1 ||
 		 client->state == POP3C_CLIENT_STATE_CONNECTING);
@@ -217,18 +217,21 @@
 		dns_set.dns_client_socket_path =
 			client->set.dns_client_socket_path;
 		dns_set.timeout_msecs = POP3C_DNS_LOOKUP_TIMEOUT_MSECS;
-		(void)dns_lookup(client->set.host, &dns_set,
-				 pop3c_dns_callback, client,
-				 &client->dns_lookup);
+		if (dns_lookup(client->set.host, &dns_set,
+			       pop3c_dns_callback, client,
+			       &client->dns_lookup) < 0)
+			failed = TRUE;
 	} else if (client->to == NULL) {
 		client->to = timeout_add(POP3C_COMMAND_TIMEOUT_MSECS,
 					 pop3c_client_timeout, client);
 		timeout_added = TRUE;
 	}
 
-	client->running = TRUE;
-	io_loop_run(ioloop);
-	client->running = FALSE;
+	if (!failed) {
+		client->running = TRUE;
+		io_loop_run(ioloop);
+		client->running = FALSE;
+	}
 
 	if (timeout_added && client->to != NULL)
 		timeout_remove(&client->to);


More information about the dovecot-cvs mailing list