From 7aa2dd189748ed57c2fb8d8d9b7cb3c4ac2f7ea5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 8 Nov 2010 18:38:31 +0000 Subject: [PATCH] lmtp: Don't allow mixed proxy/non-proxy RCPT TO destinations. Although the code attempts to handle this case already, the DATA replies aren't sent in correct order. --- src/lmtp/commands.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lmtp/commands.c b/src/lmtp/commands.c index a9c841d542..ccc376c2cd 100644 --- a/src/lmtp/commands.c +++ b/src/lmtp/commands.c @@ -256,9 +256,16 @@ static bool client_proxy_rcpt(struct client *client, const char *address, client_send_line(client, "554 5.4.6 <%s> " "Proxying loops to itself", address); pool_unref(&pool); - return FALSE; + return TRUE; } + if (array_count(&client->state.rcpt_to) != 0) { + client_send_line(client, "451 4.3.0 <%s> " + "Can't handle mixed proxy/non-proxy destinations", + address); + pool_unref(&pool); + return TRUE; + } if (client->proxy == NULL) { client->proxy = lmtp_proxy_init(client->set->hostname, dns_client_socket_path, @@ -375,6 +382,13 @@ int cmd_rcpt(struct client *client, const char *args) return 0; } + if (client->proxy != NULL) { + client_send_line(client, "451 4.3.0 <%s> " + "Can't handle mixed proxy/non-proxy destinations", + address); + return 0; + } + memset(&input, 0, sizeof(input)); input.module = input.service = "lmtp"; input.username = username; -- 2.47.3