Implementing Mail::SRS in MIMEDefang

Michael Faurot <[email protected]> Sun, 3 Oct 2004 12:28:11 -0400
Newsgroups gmane.mail.spam.srs.general
Message-ID <[email protected]>
After successfully implementing Mail::SPF::Query in MIMEDefang[1] and
getting SPF TXT records implemented in the zone files for the various
domains I administer, I'm now looking to implement Mail::SRS for some
of the domains I forward.

So far, I believe I've got the sender envelope re-writing bits worked
out.  As I'm experimenting with getting the receiving/verification part
implemented I've run into a problem.  In particular, I've been testing
$srs->reverse($srsaddress).  When the rewritten SRS address is valid,
there's no problems.  But if I deliberately use a malformed SRS address
(as a spammer would presumably do), then Mail::SRS causes my MIMEDefang
slave process to die with the following error:

	Oct  2 17:50:49 mail mimedefang-multiplexor[393]: Slave 1
	stderr: Parse error in `SRS0+YYpR7b=MV=atww.org=mfaurot':
	Invalid hash at /usr/local/share/perl/5.6.1/Mail/SRS/Shortcut.pm
	line 86.

Upon inspection of Shortcut.pm at line 86, I see the problem is this:

        unless ($self->hash_verify($hash,$timestamp,$sendhost,$senduser)) {
                die "Invalid hash";
        }

Looking around further, I see lots of use of 'die' in these modules.
This presents a problem when trying to integrate Mail::SRS into a
larger system.  I need a return code of some type to tell me whether a
particular address is invalid--not have the module terminate my program.

Please advise how I should implement validation and address reversal
using $srs->reverse(), without it terminating my programs.

Thanks.

[1]: http://www.mimedefang.org/