]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp proxy: Error handling fix.
authorTimo Sirainen <tss@iki.fi>
Tue, 24 Nov 2009 18:29:02 +0000 (13:29 -0500)
committerTimo Sirainen <tss@iki.fi>
Tue, 24 Nov 2009 18:29:02 +0000 (13:29 -0500)
--HG--
branch : HEAD

src/lib-lda/lmtp-client.c
src/lib-lda/lmtp-client.h
src/lmtp/lmtp-proxy.c

index 01ee4167e5309f394622b16cff49a69d78a571ea..9ac810b80c11f92d8a3a0d6410b1fc6838061862 100644 (file)
@@ -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);
index 2b9b1e8ccb4c9f8b90ef65dacf673e7bdf51bafc..4b0c7b56e2674899c4dd9e81e6999fe20b68a121 100644 (file)
@@ -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. */
index 4876b01675378472243c919efc315c83ae15a33d..5fe74b5784e548f958ec13761ef13856d1a976ca 100644 (file)
@@ -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);
 }