public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api] quarantine: delete Delivered-To and Return-Path when reinjecting
Date: Mon, 27 Mar 2023 21:18:13 +0200	[thread overview]
Message-ID: <20230327191813.189233-1-s.ivanov@proxmox.com> (raw)

The removal of those 2 headers was dropped in the recent rework for
quarantine delivery.
Leading to mails from quarantine being bounced by postfix 'local'
delivery agent (as the comment in the original code stated)

Reproduced by delivering a mail from quarantine to a postfix instance,
which routes it to a local account

Fixes: e51fe74 ("quarantine: use reinject_local_mail to deliver quarantined mail")
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
noticed while testing if the OCR detection of SpamAssassin actually works
Huge Thanks to Martin for suggesting the test!

 src/PMG/Quarantine.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/PMG/Quarantine.pm b/src/PMG/Quarantine.pm
index bd5e63b..b80a5a3 100644
--- a/src/PMG/Quarantine.pm
+++ b/src/PMG/Quarantine.pm
@@ -108,6 +108,11 @@ sub deliver_quarantined_mail {
     my $entity = $parser->parse_open("$path");
     PMG::MIMEUtils::fixup_multipart($entity);
 
+    # delete Delivered-To and Return-Path (avoid problem with postfix
+    # forwarding loop detection (man local))
+    $entity->head->delete('Delivered-To');
+    $entity->head->delete('Return-Path');
+
     my $sender = 'postmaster'; # notify postmaster if something fails
 
     eval {
-- 
2.30.2





             reply	other threads:[~2023-03-27 19:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 19:18 Stoiko Ivanov [this message]
2023-03-28  5:59 ` [pmg-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230327191813.189233-1-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal