[pmg-devel] [PATCH proxmox-spamassassin] fix #2359: backport bufix for SpamAssassin bug 7577

Stoiko Ivanov s.ivanov at proxmox.com
Fri Sep 6 19:14:57 CEST 2019


Thanks for finding this so fast!

One inconsequential and cosmetic nit inline:

On Fri,  6 Sep 2019 09:46:13 +0200
Dominik Csapak <d.csapak at proxmox.com> wrote:

> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  debian/patches/bug_7577_freemail_plugin | 81 +++++++++++++++++++++++++
>  debian/patches/series                   |  1 +
>  2 files changed, 82 insertions(+)
>  create mode 100644 debian/patches/bug_7577_freemail_plugin
> 
> diff --git a/debian/patches/bug_7577_freemail_plugin b/debian/patches/bug_7577_freemail_plugin
> new file mode 100644
> index 0000000..8d882ba
> --- /dev/null
> +++ b/debian/patches/bug_7577_freemail_plugin
> @@ -0,0 +1,81 @@
> +backport bugfix for https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7577 
> +see https://svn.apache.org/viewvc?view=revision&revision=1844813
> +Index: Mail-SpamAssassin-3.4.2/lib/Mail/SpamAssassin/Plugin/Phishing.pm
> +===================================================================
> +--- Mail-SpamAssassin-3.4.2.orig/lib/Mail/SpamAssassin/Plugin/Phishing.pm
> ++++ Mail-SpamAssassin-3.4.2/lib/Mail/SpamAssassin/Plugin/Phishing.pm
> +@@ -170,15 +170,11 @@ sub _read_configfile {
> + sub check_phishing {
> +   my ($self, $pms) = @_;
> + 
> +-  my $desc;
> +   my $feedname;
> +   my $domain;
> +   my $uris = $pms->get_uri_detail_list();
> + 
> +   my $rulename = $pms->get_current_eval_rule_name();
> +-  if (defined $pms->{conf}->{descriptions}->{$rulename}) {
> +-    $desc = $pms->{conf}->{descriptions}->{$rulename};
> +-  }
> + 
> +   while (my($uri, $info) = each %{$uris}) {
> +     # we want to skip mailto: uris
> +@@ -194,7 +190,8 @@ sub check_phishing {
> +              $domain = $self->{main}->{registryboundaries}->uri_to_domain($cluri);
> +              $feedname = $pms->{PHISHING}->{phishinfo}->{$domain}[0];
> +              dbg("HIT! $domain [$cluri] found in $feedname feed");
> +-             $pms->got_hit($rulename, "", description => $desc . " $feedname ($domain)", ruletype => 'eval');
> ++             $pms->test_log("$feedname ($domain)");
> ++             $pms->got_hit($rulename, "", ruletype => 'eval');
> +              return 1;
> +            }
> +         }
> +Index: Mail-SpamAssassin-3.4.2/lib/Mail/SpamAssassin/Plugin/HashBL.pm
> +===================================================================
> +--- Mail-SpamAssassin-3.4.2.orig/lib/Mail/SpamAssassin/Plugin/HashBL.pm
> ++++ Mail-SpamAssassin-3.4.2/lib/Mail/SpamAssassin/Plugin/HashBL.pm
> +@@ -166,14 +166,11 @@ sub _parse_body {
> + }
> + 
> + sub _got_hit {
> +-    my ($self, $pms, $rulename, $email, $desc) = @_;
> +-
> +-    if (defined $pms->{conf}->{descriptions}->{$rulename}) {
> +-        $desc = $pms->{conf}->{descriptions}->{$rulename};
> +-    }
> ++    my ($self, $pms, $rulename, $email) = @_;
> + 
> +     $email =~ s/\@/[at]/g;
> +-    $pms->got_hit($rulename, "", description => $desc." ($email)", ruletype => 'eval');
> ++    $pms->test_log($email);
> ++    $pms->got_hit($rulename, "",  ruletype => 'eval');
the two spaces before 'ruletype' are not present in the original diff
(https://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/HashBL.pm?r1=1844139&r2=1844813&pathrev=1844813&view=patch)
however we can easily clean this up when 3.4.3 comes out (and we rebase
our patchset on that)
(I just found it because I compared the patch to the commit in the
github mirror of SA's svn (https://github.com/apache/spamassassin.git)


> + }
> + 
> + sub _submit_email_query {
> +@@ -255,7 +252,6 @@ sub check_hashbl_emails {
> +     $#emails = 9 if (scalar @emails > 10);
> + 
> +     foreach my $email (@emails) {
> +-        #$self->_got_hit($pms, $email, "Email found in list $list");
> +         dbg("BODY: $email");
> +         $self->_submit_email_query($pms, $list, (($type) ? $type : 'SHA1'), $email);
> +     }
> +Index: Mail-SpamAssassin-3.4.2/lib/Mail/SpamAssassin/Plugin/FreeMail.pm
> +===================================================================
> +--- Mail-SpamAssassin-3.4.2.orig/lib/Mail/SpamAssassin/Plugin/FreeMail.pm
> ++++ Mail-SpamAssassin-3.4.2/lib/Mail/SpamAssassin/Plugin/FreeMail.pm
> +@@ -395,11 +395,10 @@ sub _got_hit {
> + 
> +     if ($pms->{main}->{conf}->{freemail_add_describe_email}) {
> +         $email =~ s/\@/[at]/g;
> +-        $pms->got_hit($rulename, "", description => $desc." ($email)", ruletype => 'eval');
> +-    }
> +-    else {
> +-        $pms->got_hit($rulename, "", description => $desc, ruletype => 'eval');
> ++        $pms->test_log($email);
> +     }
> ++
> ++    $pms->got_hit($rulename, "", description => $desc, ruletype => 'eval');
> + }
> + 
> + sub check_freemail_header {
> diff --git a/debian/patches/series b/debian/patches/series
> index 78f208c..ff4acec 100644
> --- a/debian/patches/series
> +++ b/debian/patches/series
> @@ -1 +1,2 @@
>  disable-dkim.patch
> +bug_7577_freemail_plugin

I gave it a spin on my testsetup here and verified that the addresses don't
get added anymore to the spam-info header.

Reviewed-By: Stoiko Ivanov <s.ivanov at proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov at proxmox.com>



More information about the pmg-devel mailing list