Subject: | Can't fetch correct macros, can't set some headers |
Date: | Tue, 30 Apr 2013 09:40:16 -0500 |
To: | bug-Sendmail-PMilter [...] rt.cpan.org |
From: | Chris Adams <perl [...] cmadams.net> |
I have found a couple of bugs in version 1.00 of Sendmail::PMilter
(in the Sendmail::PMilter::Context module):
- The main loop stores macros by milter state, but $ctx->getsymval looks
in a pre-set subset of the states. This means that macros set in
other states (such as EOM) can't be fetched. A quick-and-dirty change
is to look in all known states:
- foreach my $code (SMFIC_RCPT, SMFIC_MAIL, SMFIC_HELO, SMFIC_CONNECT) {
+ foreach my $code (SMFIC_UNKNOWN, SMFIC_DATA, SMFIC_QUIT, SMFIC_RCPT,
+ SMFIC_OPTNEG, SMFIC_EOH, SMFIC_MAIL, SMFIC_HEADER, SMFIC_HELO,
+ SMFIC_BODYEOB, SMFIC_MACRO, SMFIC_CONNECT, SMFIC_BODY,
+ SMFIC_ABORT) {
A better fix may actually be to just store macros in a single hash as
they come in. I don't think there is any reason to keep them
separate.
- $ctx->addheader checks for a header name/value setting with "||", which
fails when trying to set a header value of "0" (for example, a spam
score). I fixed this with:
- my $header = shift || die "addheader: no header name\n";
- my $value = shift || die "addheader: no header value\n";
+ my $header = shift;
+ my $value = shift;
+ die "addheader: no header name\n" if (! defined ($header));
+ die "addheader: no header value\n" if (! defined ($value));
--
Chris Adams <perl@cmadams.net>