changeset 12733:aba5a6a24b99

lmtp: Don't forget LHLO host when sending multiple messages in session.
author Timo Sirainen <tss@iki.fi>
date Thu, 17 Feb 2011 08:12:21 +0200
parents 049a922c193c
children 3c61817f30bb
files src/lmtp/client.c src/lmtp/client.h src/lmtp/commands.c
diffstat 3 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lmtp/client.c	Fri Feb 11 23:44:39 2011 +0200
+++ b/src/lmtp/client.c	Thu Feb 17 08:12:21 2011 +0200
@@ -230,7 +230,7 @@
 	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 @@
 	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);
 
--- a/src/lmtp/client.h	Fri Feb 11 23:44:39 2011 +0200
+++ b/src/lmtp/client.h	Thu Feb 17 08:12:21 2011 +0200
@@ -12,7 +12,6 @@
 };
 
 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 mail_user *raw_mail_user;
 	const char *my_domain;
+	char *lhlo;
 
 	pool_t state_pool;
 	struct client_state state;
--- a/src/lmtp/commands.c	Fri Feb 11 23:44:39 2011 +0200
+++ b/src/lmtp/commands.c	Thu Feb 17 08:12:21 2011 +0200
@@ -71,7 +71,8 @@
 	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 @@
 	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",