From a5006a909059e051572fb5428639dec099f1d359 Mon Sep 17 00:00:00 2001 From: Mechiel Lukkien Date: Mon, 11 Sep 2023 11:37:45 +0200 Subject: [PATCH] fix not adding duplicate domains to the list of "verified dkim domains" for incoming messages --- smtpserver/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/smtpserver/server.go b/smtpserver/server.go index b32eae2..95d4bd0 100644 --- a/smtpserver/server.go +++ b/smtpserver/server.go @@ -2124,16 +2124,16 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW // Prepare for analyzing content, calculating reputation. ipmasked1, ipmasked2, ipmasked3 := ipmasked(c.remoteIP) var verifiedDKIMDomains []string + dkimSeen := map[string]bool{} for _, r := range dkimResults { // A message can have multiple signatures for the same identity. For example when // signing the message multiple times with different algorithms (rsa and ed25519). - seen := map[string]bool{} if r.Status != dkim.StatusPass { continue } d := r.Sig.Domain.Name() - if !seen[d] { - seen[d] = true + if !dkimSeen[d] { + dkimSeen[d] = true verifiedDKIMDomains = append(verifiedDKIMDomains, d) } }