On Tue, Aug 17, 2004 at 12:33:28AM +0200, Malte S. Stretz wrote:
> While I tracked another possible bug (see [1]), I had a look how check_dcc 
> works.  And was completely puzzled by the code.

Heh.

> check_dcc() calls
>   $self->get('X-DCC-(?:[^:]+-)?Metrics')
> to shortcut some ocde path.  That's obviously intended to be a RE.  But on 
> the whole path through the code I can't find the point where the header is 
> matched via a RE.

Well, now that you mention it...  PMS::get() doesn't accept an RE.

> Follow me through the code, maybe you can enlighten me:
> 2. PerMsgStatus.pm:1175: get('X-DCC-(?:[^:]+-)?Metrics', undef)

Yeah, that's not going to work.

> -> PerMsgStatus.pm:1227: calls Message::Node::get_header()

doesn't do an RE either.

> Ok, so where's the RE applied?  Even if other code paths were taken I can't 
> find any point where the string is made an RE and I can't believe that the 
> mail parser puts the "Header" check_dcc() wants into the cache-hash.

Yeah, so we ought to replace:

  $_ = $self->get('X-DCC-(?:[^:]+-)?Metrics');
  return 1 if /bulk/;

with:

  return 1 if grep(/^X-DCC-(?:[^:]+-)?Metrics:/ && /bulk/, 
@{$self->{msg}->get_all_headers()});

Time for a ticket... :(

> Another weird thing:  The header cache in PerMsgStatus::get():
>  - it doesn't compare case-insensitive (probably intended as it seems like
>    ALL and ToCc are case sensitive, too)

Yeah, because you may want to check MIME-Version and MiME-Version, for instance.

-- 
Randomly Generated Tagline:
"Never make any mistaeks."
 (Anonymous, in a mail discussion about to a kernel bug report.)

Attachment: pgp4xawOcDppG.pgp
Description: PGP signature

Reply via email to