fix not adding duplicate domains to the list of "verified dkim domains" for incoming messages

This commit is contained in:
Mechiel Lukkien 2023-09-11 11:37:45 +02:00
parent cb1b133e28
commit a5006a9090
No known key found for this signature in database

View file

@ -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)
}
}