public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Stoiko Ivanov <s.ivanov@proxmox.com>, pmg-devel@lists.proxmox.com
Subject: Re: [pmg-devel] [PATCH pmg-api 2/2] smtputf8: keep smtputf8 from incoming postfix, detect for local mail
Date: Wed, 25 Jan 2023 10:30:09 +0100	[thread overview]
Message-ID: <cd684988-2918-07e6-7f3a-14e27fbcd4c7@proxmox.com> (raw)
In-Reply-To: <20230123155521.28307-3-s.ivanov@proxmox.com>

Am 23/01/2023 um 16:55 schrieb Stoiko Ivanov:
> This patch changes the detection if smtputf8 is needed as option to
> the 'MAIL' command:
> * for mail passing arriving through postfix it is only added if the
>   mail originally was received with it (Accept and BCC actions)
> * for locally generated mail (Notify, reports, quarantine-link and
>   ndrs) it is decided based on utf8 characters in the mail-addresses or
>   headers
> 
> This should approximate postfix own behavior in those cases quite
> closely:
> https://www.postfix.org/SMTPUTF8_README.html#using
> 
> Notable difference is that we check the complete e-mail address and
> not only the domain part, but I assume non-ascii local-parts to be a
> very fringe edge-case in environments where smtputf8 is not supported.
> If this occurs in the wild we would also need to adapt the
> unconditional encoding of the envelope addresses in reinject_mail
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
>  src/PMG/API2/Quarantine.pm |  7 ++++++-
>  src/PMG/RuleDB/Notify.pm   |  6 +++++-
>  src/PMG/SMTP.pm            |  7 ++++++-
>  src/PMG/Utils.pm           | 16 +++++++++++++---
>  4 files changed, 30 insertions(+), 6 deletions(-)
> 
> diff --git a/src/PMG/API2/Quarantine.pm b/src/PMG/API2/Quarantine.pm
> index fbb302a..352f6b6 100644
> --- a/src/PMG/API2/Quarantine.pm
> +++ b/src/PMG/API2/Quarantine.pm
> @@ -1239,7 +1239,12 @@ my sub send_link_mail {
>      );
>  
>      # we use an empty envelope sender (we don't want to receive NDRs)

forgot to keep comment near method call?

> -    PMG::Utils::reinject_mail ($mail, '', [$receiver], undef, $fqdn);
> +
> +    my $params;
> +    if (PMG::Utils::mail_needs_smtputf8($mail, '', [$receiver])) {
> +	$params->{mail}->{smtputf8} = 1;
> +    }

I'd rather move this into reinject mail instead of copyi-pastaing the same
code hunk five times around, after all it has all the info required to
call mail_needs_smtputf8 there. FWICT, its done on all call sites, so you
wouldn't even require to add an opt-out param.

> +    PMG::Utils::reinject_mail ($mail, '', [$receiver], undef, $fqdn, $params);
>  }
>  
>  __PACKAGE__->register_method ({


> diff --git a/src/PMG/Utils.pm b/src/PMG/Utils.pm
> index 9c6f841..1ccd7d2 100644
> --- a/src/PMG/Utils.pm
> +++ b/src/PMG/Utils.pm
> @@ -232,6 +232,10 @@ sub mail_needs_smtputf8 {
>  	}
>      }
>  
> +    if ($entity->head()->as_string() =~ /([^\p{PosixPrint}\n\r\t])/) {
> +	return 1;
> +    }


you're reintroducing the hunk you removed in patch 1/2 without really adding any
explicit reasoning, or is 1/2 just intended as uncontroversial stop gap to apply
while 2/2 is still being checked more closely, or what's the deal here?

 




  reply	other threads:[~2023-01-25  9:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 15:55 [pmg-devel] [PATCH pmg-api 0/2] fix smtputf8 handling if disabled in postfix Stoiko Ivanov
2023-01-23 15:55 ` [pmg-devel] [PATCH pmg-api 1/2] utils: skip checking headers for non-ascii characters Stoiko Ivanov
2023-01-25 10:04   ` [pmg-devel] applied: " Thomas Lamprecht
2023-01-23 15:55 ` [pmg-devel] [PATCH pmg-api 2/2] smtputf8: keep smtputf8 from incoming postfix, detect for local mail Stoiko Ivanov
2023-01-25  9:30   ` Thomas Lamprecht [this message]
2023-01-25  9:48     ` Stoiko Ivanov
2023-01-25 10:04       ` 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=cd684988-2918-07e6-7f3a-14e27fbcd4c7@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    --cc=s.ivanov@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