From a51aa469f3647b90d83fc616be571f6f9e463678 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Wed, 17 Apr 2024 13:07:19 -0500 Subject: [PATCH] Move Authentication-Results to transaction The authentication results from SPF/DKIM/etc. are part of a single message transaction, not the whole SMTP connection. Without this change, when multiple messages are received during a single SMTP connection, the SPF/DKIM/etc. results just keep getting appended to an Authentication-Results header. --- lib/Qpsmtpd/Plugin.pm | 6 +++--- lib/Qpsmtpd/SMTP.pm | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Qpsmtpd/Plugin.pm b/lib/Qpsmtpd/Plugin.pm index 50d1917e..2094e6ce 100644 --- a/lib/Qpsmtpd/Plugin.pm +++ b/lib/Qpsmtpd/Plugin.pm @@ -270,13 +270,13 @@ sub store_deferred_reject { sub store_auth_results { my ($self, $result) = @_; - my $auths = $self->qp->connection->notes('authentication_results') or do { - $self->qp->connection->notes('authentication_results', $result); + my $auths = $self->qp->transaction->notes('authentication_results') or do { + $self->qp->transaction->notes('authentication_results', $result); return; }; my $ar = join('; ', $auths, $result); $self->log(LOGDEBUG, "auth-results: $ar"); - $self->qp->connection->notes('authentication_results', $ar); + $self->qp->transaction->notes('authentication_results', $ar); } sub is_immune { diff --git a/lib/Qpsmtpd/SMTP.pm b/lib/Qpsmtpd/SMTP.pm index 913879d5..ca1fa7a0 100644 --- a/lib/Qpsmtpd/SMTP.pm +++ b/lib/Qpsmtpd/SMTP.pm @@ -793,8 +793,8 @@ sub authentication_results { } # RFC 5451: used in AUTH, DKIM, DOMAINKEYS, SENDERID, SPF - if ($self->connection->notes('authentication_results')) { - push @auth_list, $self->connection->notes('authentication_results'); + if ($self->transaction->notes('authentication_results')) { + push @auth_list, $self->transaction->notes('authentication_results'); } $self->log(LOGDEBUG, "adding auth results header");