From: Timo Sirainen Date: Thu, 17 Feb 2011 06:12:21 +0000 (+0200) Subject: lmtp: Don't forget LHLO host when sending multiple messages in session. X-Git-Tag: 2.0.10~54 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fcd443a32b01c4da131f36649d5a5fa5f8452dcf;p=thirdparty%2Fdovecot%2Fcore.git lmtp: Don't forget LHLO host when sending multiple messages in session. --- diff --git a/src/lmtp/client.c b/src/lmtp/client.c index 16bff8b4ed..d08cb93aeb 100644 --- a/src/lmtp/client.c +++ b/src/lmtp/client.c @@ -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); diff --git a/src/lmtp/client.h b/src/lmtp/client.h index 522fe91fe2..dc24015968 100644 --- a/src/lmtp/client.h +++ b/src/lmtp/client.h @@ -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; diff --git a/src/lmtp/commands.c b/src/lmtp/commands.c index 8de0046085..81ea4c7407 100644 --- a/src/lmtp/commands.c +++ b/src/lmtp/commands.c @@ -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",