From: Timo Sirainen Date: Tue, 24 Nov 2009 18:29:02 +0000 (-0500) Subject: lmtp proxy: Error handling fix. X-Git-Tag: 2.0.beta1~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16f9bf9a2f2f90f3e6e0c5125c976f7b2dbfce14;p=thirdparty%2Fdovecot%2Fcore.git lmtp proxy: Error handling fix. --HG-- branch : HEAD --- diff --git a/src/lib-lda/lmtp-client.c b/src/lib-lda/lmtp-client.c index 01ee4167e5..9ac810b80c 100644 --- a/src/lib-lda/lmtp-client.c +++ b/src/lib-lda/lmtp-client.c @@ -83,7 +83,7 @@ lmtp_client_init(const char *mail_from, const char *my_hostname) return client; } -static void lmtp_client_close(struct lmtp_client *client) +void lmtp_client_close(struct lmtp_client *client) { if (client->io != NULL) io_remove(&client->io); diff --git a/src/lib-lda/lmtp-client.h b/src/lib-lda/lmtp-client.h index 2b9b1e8ccb..4b0c7b56e2 100644 --- a/src/lib-lda/lmtp-client.h +++ b/src/lib-lda/lmtp-client.h @@ -21,6 +21,7 @@ void lmtp_client_deinit(struct lmtp_client **client); int lmtp_client_connect_tcp(struct lmtp_client *client, enum lmtp_client_protocol protocol, const char *host, unsigned int port); +void lmtp_client_close(struct lmtp_client *client); /* Add headers from given string before the rest of the data. The string must use CRLF line feeds and end with CRLF. */ diff --git a/src/lmtp/lmtp-proxy.c b/src/lmtp/lmtp-proxy.c index 4876b01675..5fe74b5784 100644 --- a/src/lmtp/lmtp-proxy.c +++ b/src/lmtp/lmtp-proxy.c @@ -81,8 +81,10 @@ static void lmtp_proxy_connections_deinit(struct lmtp_proxy *proxy) unsigned int i, count; conns = array_get(&proxy->connections, &count); - for (i = 0; i < count; i++) + for (i = 0; i < count; i++) { lmtp_client_fail(conns[i]->client, "451 4.3.0 Aborting"); + lmtp_client_deinit(&conns[i]->client); + } } void lmtp_proxy_deinit(struct lmtp_proxy **_proxy) @@ -146,8 +148,7 @@ lmtp_proxy_get_connection(struct lmtp_proxy *proxy, static void lmtp_proxy_conn_close(struct lmtp_proxy_connection *conn) { - if (conn->client != NULL) - lmtp_client_deinit(&conn->client); + lmtp_client_close(conn->client); if (conn->data_input != NULL) i_stream_unref(&conn->data_input); }