Bug 4623 - [review] update to support Mail::DomainKeys API change
Summary: [review] update to support Mail::DomainKeys API change
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Plugins (show other bugs)
Version: 3.1.0
Hardware: PC Linux
: P5 normal
Target Milestone: 3.1.1
Assignee: Justin Mason
Whiteboard: ready
Depends on:
Reported: 2005-10-09 11:10 UTC by Chris
Modified: 2006-02-02 12:51 UTC (History)
3 users (show)

Attachment Type Modified Status Actions Submitter/CLA Status
Patch for DomainKeys plugin patch None Richard Birkett [HasCLA]
backwards-compatible fix patch None Justin Mason [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Chris 2005-10-09 11:10:02 UTC
When the Domain Keys plugin is active it reports:

Can't locate object method "header" via package "Mail::DomainKeys::Message" at
/usr/lib/perl5/site_perl/5.8.5/Mail/SpamAssassin/Plugin/DomainKeys.pm line 213,
<GEN88> line 90. 
rules: failed to run DK_POLICY_SIGNALL test, skipping:

This is with Mail::DomainKeys module V0.80 and SA 3.1
Comment 1 Theo Van Dinter 2005-10-09 12:03:42 UTC
Subject: Re:   New: Domain Keys plugin not functioning correctly

On Sun, Oct 09, 2005 at 11:10:02AM -0700, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> Can't locate object method "header" via package "Mail::DomainKeys::Message" at
> This is with Mail::DomainKeys module V0.80 and SA 3.1

It looks like they changed the API a bit between 0.18 (when the plugin
was written) and 0.80...  <grrr>

Comment 2 Greg Ennis 2005-10-09 12:05:38 UTC
I have two Red Hat 8.0 systems that have the same bug
Mail::DomainKeys module V0.80 and SA 3.1 with perl 5.8.0 are installed on each one.
Comment 3 openmacnews 2005-10-15 21:28:51 UTC
simply confirming the prob ...


   SA cvs r321518
   Mail::DomainKeys v0.80
   perl v5.8.7
   on OSX 10.4.2

with the same issue/symptoms "Can't locate object method ..."


Comment 4 Richard Birkett 2005-10-26 18:31:39 UTC
Created attachment 3210 [details]
Patch for DomainKeys plugin

This patch adds directly into the SA plugin code a simplified version of the
old Mail::DomainKeys::Message::header() method.  This method seems to have been
removed while making Mail::DomainKeys compatible with draft 3 of the spec
(which deprecated the DomainKey-Status header).

This allows the plugin to work with Mail::DomainKeys 0.80 and above, though it
should be backward compatible with earlier versions.  The patch is against the
SVN trunk, though it should apply OK to recent releases too.
Comment 5 openmacnews 2005-10-28 05:38:04 UTC
just built up a new instance (r328930), applying Richard's patch from comment #4.

testing with "-lint", i can confirm i no longer see the "Can't locate object
method ..." error.

thx richard.


Comment 6 luchris 2005-11-01 06:25:39 UTC
How do i apply the patch?
Comment 7 Tom Schulz 2005-11-01 15:31:15 UTC
If you have the gnu patch utility available or have a patch utility that acts
the same, do the following.  Save the patch to a file.  Put the file into the
base directory of the SpamAssassin distribution. Give the following command:
patch -p0 < name_of_patch_file_here
The other way is to edit the DomainKeys.pm file and make the changes by hand.
Comment 8 Justin Mason 2005-12-12 21:31:11 UTC
Comment 9 Daryl C. W. O'Shea 2005-12-12 21:52:02 UTC
Has anyone confirmed that the patch is in fact backwards compatible?
Comment 10 Justin Mason 2005-12-13 00:16:14 UTC
hmm, I suppose we do need backwards compat.
Comment 11 Michael Parker 2005-12-13 01:56:29 UTC
It sounds like the module has gone through a large change, better to just
enforce the use of the new API version
Comment 12 Matthew van Eerde 2005-12-13 02:04:16 UTC
In which case should there be a version check?

unless ($Mail::DomainKeys::VERSION >= 0.8)
  die("Mail::SpamAssassin::Plugin::DomainKeys requires Mail::DomainKeys version
0.8 or higher");
Comment 13 Tom Schulz 2005-12-13 15:10:57 UTC
The patch just puts code into DomainKeys.pm that is in the older versions
of Mail::DomainKeys.  For older versions of Mail::DomainKeys, running the
code in DomainKeys.pm instead of in Mail::DomainKeys should not matter.
On the other hand, it may be that old versions of Mail::DomainKeys are too
broken to be usefull.  Requiring a newer version may be good for that reason.
Comment 14 Justin Mason 2005-12-19 08:26:03 UTC
'It sounds like the module has gone through a large change, better to just
enforce the use of the new API version'

unless there were essential bugfixes, I'd prefer to just support both APIs.
Comment 15 Justin Mason 2005-12-19 08:47:22 UTC
Created attachment 3312 [details]
backwards-compatible fix

here's a redo of that patch that uses the new API if it exists, but will fall
back to header() if it doesn't, to support the pre-0.80 case.
Comment 16 Justin Mason 2005-12-19 08:49:31 UTC
Committed revision 357663.
Comment 17 Daryl C. W. O'Shea 2006-01-12 03:16:27 UTC
+1 -- confirmed to work with both Mail::DomainKeys 0.23 and 0.80
Comment 18 Daryl C. W. O'Shea 2006-01-12 03:43:13 UTC
I vote the biggest offender patches bugzilla to automatically add the previous
bug owner to the CC: list when someone takes a bug. ;)
Comment 19 Duncan Findlay 2006-01-25 01:58:59 UTC
Comment 20 Michael Parker 2006-02-02 16:33:58 UTC
Comment 21 Justin Mason 2006-02-02 21:51:38 UTC