From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: Daniel Berteaud <daniel@firewall-services.com>
Cc: pmg-devel@lists.proxmox.com
Subject: Re: [pmg-devel] [PATCH v2 pmg-api 1/1] [pmg-api] fix #3098 sort domains by length first
Date: Thu, 29 Oct 2020 11:05:46 +0100 [thread overview]
Message-ID: <20201029110546.54b268a6@rosa.proxmox.com> (raw)
In-Reply-To: <20201028102015.628005-2-daniel@firewall-services.com>
Thanks for adapting your patch and trying it out!
LGTM - I quickly tested it on my test-system with some syntetic
test-domains - it works as I'd expect it to:
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
On Wed, 28 Oct 2020 11:20:15 +0100
Daniel Berteaud <daniel@firewall-services.com> wrote:
> So if we have a sub domain and its parent in the list, the correct one will be returned
>
> Signed-off-by: Daniel Berteaud <daniel@firewall-services.com>
> ---
> src/PMG/DKIMSign.pm | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/PMG/DKIMSign.pm b/src/PMG/DKIMSign.pm
> index 7cb06a6..08197f8 100644
> --- a/src/PMG/DKIMSign.pm
> +++ b/src/PMG/DKIMSign.pm
> @@ -69,7 +69,9 @@ sub signing_domain {
> my $dkimdomains = PVE::INotify::read_file('dkimdomains');
> $dkimdomains = PVE::INotify::read_file('domains') if !scalar(%$dkimdomains);
>
> - foreach my $domain (sort keys %$dkimdomains) {
> + # Sort domains by length first, so if we have both a sub domain and its parent
> + # the correct one will be returned
> + foreach my $domain (sort { length($b) <=> length($a) || $a cmp $b} keys %$dkimdomains) {
> if ( $input_domain =~ /\Q$domain\E$/i ) {
> $self->domain($domain);
> return 1;
next prev parent reply other threads:[~2020-10-29 10:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-28 10:20 [pmg-devel] [PATCH v2 pmg-api 0/1] Select the correct domain for the DKIM Daniel Berteaud
2020-10-28 10:20 ` [pmg-devel] [PATCH v2 pmg-api 1/1] [pmg-api] fix #3098 sort domains by length first Daniel Berteaud
2020-10-29 10:05 ` Stoiko Ivanov [this message]
2020-11-18 7:11 ` [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=20201029110546.54b268a6@rosa.proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=daniel@firewall-services.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