]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp: Don't forget LHLO host when sending multiple messages in session.
authorTimo Sirainen <tss@iki.fi>
Thu, 17 Feb 2011 06:12:21 +0000 (08:12 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 17 Feb 2011 06:12:21 +0000 (08:12 +0200)
src/lmtp/client.c
src/lmtp/client.h
src/lmtp/commands.c

index 16bff8b4ed703a057dabf14faf610ca48a069208..d08cb93aeb4fd3ddcac296ac5062317395a9d6b3 100644 (file)
@@ -230,7 +230,7 @@ struct client *client_create(int fd_in, int fd_out,
        client_raw_user_create(client);
        client_generate_session_id(client);
        client->my_domain = client->set->hostname;
-       client->state.lhlo = "missing";
+       client->lhlo = i_strdup("missing");
 
        DLLIST_PREPEND(&clients, client);
        clients_count++;
@@ -264,6 +264,7 @@ void client_destroy(struct client *client, const char *prefix,
        if (client->fd_in != client->fd_out)
                net_disconnect(client->fd_out);
        client_state_reset(client);
+       i_free(client->lhlo);
        pool_unref(&client->state_pool);
        pool_unref(&client->pool);
 
index 522fe91fe21af8526ad36d8254f557d60b0978f2..dc24015968cbecc4db65520e2c9af26c9f69daf0 100644 (file)
@@ -12,7 +12,6 @@ struct mail_recipient {
 };
 
 struct client_state {
-       const char *lhlo;
        const char *session_id;
        const char *mail_from;
        ARRAY_DEFINE(rcpt_to, struct mail_recipient);
@@ -58,6 +57,7 @@ struct client {
 
        struct mail_user *raw_mail_user;
        const char *my_domain;
+       char *lhlo;
 
        pool_t state_pool;
        struct client_state state;
index 8de004608521d0dd8b7239cb6e0e36b64f0dc56e..81ea4c74077ba936dc9be2e7f390c305a267583d 100644 (file)
@@ -71,7 +71,8 @@ int cmd_lhlo(struct client *client, const char *args)
        client_send_line(client, "250-ENHANCEDSTATUSCODES");
        client_send_line(client, "250 PIPELINING");
 
-       client->state.lhlo = p_strdup(client->state_pool, str_c(domain));
+       i_free(client->lhlo);
+       client->lhlo = i_strdup(str_c(domain));
        return 0;
 }
 
@@ -712,7 +713,7 @@ static const char *client_get_added_headers(struct client *client)
        if (rcpt_to != NULL)
                str_printfa(str, "Delivered-To: <%s>\r\n", rcpt_to);
 
-       str_printfa(str, "Received: from %s", client->state.lhlo);
+       str_printfa(str, "Received: from %s", client->lhlo);
        if ((host = net_ip2addr(&client->remote_ip)) != NULL)
                str_printfa(str, " ([%s])", host);
        str_printfa(str, "\r\n\tby %s ("PACKAGE_NAME") with LMTP id %s",