Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Aug 2003 21:15:11 -0400
From:      James Quick <jq@quick.com>
To:        bugs@procmail.org
Cc:        ache@FreeBSD.org
Subject:   FreeBSD Port: procmail-3.22_2- bug affecting procmail 3.22 and 3.15.2
Message-ID:  <EDC96FD8-C54F-11D7-911C-003065C496DC@quick.com>

next in thread | raw e-mail | index | archive | help
Hi, guys at FreeBSD and to whoever might be listening on the bug mailing
list at procmail.org.

I found a bug in the procmail version 3.22_2 from the FreeBSD ports 
tree.
Only after I found the bug and tested the patch, did I find a reference 
to
a checked out copy of the 3.23pre code.  In that, I saw the bug fixed by
replacing a for loop with a call to bzero().

As a freebsd user, I am sending it in to the people responsible for the,
because adding a patch file to the tree, may prove useful to people in 
the
short term.  Also, though it works the same there as everywhere else, 
it's broken.
Of course I'm also sending it to you guys who work on procmail, for 
obvious reasons.
It appears that the bug has been around for a long time.

Description of the bug:

The bug concerns the use of the B flag to search only the body of the 
message.

In release 3.22 if a prior rule has searched the Header, all subsequent 
rules
where :0 B is used alone, will search as if :0 HB were specified.  i.e. 
once
set, I do not believe it is ever cleared.

In release 3.15.2, which I grepped, but have not tested.  It appears 
that any
use of either H or B in a search, will from that point on, cause that 
portion
of the message to be actively searched.

Here are the defects causing the bug(s):

A:              for(i=maxindex(flags);flags[i]=0,i--;);     /* clear 
the flags */

B:         for(i=maxindex(flags);i;i--)                   /* clear the 
flags */
B:             flags[i]=0;

C:          for(i=maxindex(flags);i >= 0;i--)                      /* 
clear the flags */
C:             flags[i]=0;

In the following description 'Last' = maxindex(flags)
A: is from version 3.15.2 it clears one flag at flags[Last],
B: is from the freebsd port version 3.22_2 it clears flags[1] - 
flags[Last].
C: is after my patch, it clears all the flags.
(flags[0] is the flag specifying whether to include the mail header in 
the search)


Analysis:
The patch enables procmail to search only the headers, only the body, 
or both.

Since searching the header was always the default.  This will not alter 
the result of any
searches in procmail 3.22 preceded by:
:0
or
:0 H
or
:0 BH
It will mean, however, that
:0 B
will now work as advertised. To the delight of some and the 
consternation of
others.

In version 3.15.2, the impact will be greater.  Currently any use of 
either
B or A, explicitly, causes the respective section to be forever 
searched.

I've done my part,  I'd like to see a either a patch-file in the ports 
tree
against the current distfile, (just because I'm both impatient and 
lazy) :-)
But since I don't know if or when the procmail team will choose to 
release
a new version, I'll step back and see what happens.

Sincerely,
James Quick

p.s. Thank You(s) are in order.

Thanks to procmail, I've had a manageable mailbox hierarchy and reduced
spam load since 1999.  Now I can finally improve my ruleset with a
couple B restricted sub-blocks.

Thanks to FreeBSD, I've had secure firewalls, and mail servers, so I've 
got that
mail to sort and read.  Honestly, with cvsup and about 80 lines of 
shell scripts
I've spent an average of 1 day per year on software maintenance.  It 
has not crashed
once since installation in 1999.  That's even considering that it's 
been at 5.x since
May 2001, because I just *had* to have soft-updates, snapshots, and 
jails.
I honestly don't understand why so many people use Linux...

Thanks to Apple, are in order, since without Project Builder I would 
not have
found the bug.  I tried stepping though in gdb and got lost in the 
code. So
I loaded the source up on my laptop, and within 10 minutes, tracked it 
down,
It was actually closer to 20 minutes, but I was watching Buffy the 
Vampire Slayer
so I was slacking off....

Following are copies of the patch against 3.22 in text and uuencoded 
form.
Have fun with it.

---------------------------------------------


*** src/procmail.c.orig Tue Sep 11 00:59:14 2001
--- src/procmail.c      Sat Aug  2 18:55:35 2003
***************
*** 652,658 ****
               nrcond= -1;
            if(tolock)            /* clear temporary buffer for lockfile 
name */
               free(tolock);
!          for(i=maxindex(flags);i;i--)                   /* clear the 
flags */
               flags[i]=0;
            for(tolock=0,locknext=0;;)
             { chp=skpspace(chp);
--- 652,658 ----
               nrcond= -1;
            if(tolock)            /* clear temporary buffer for lockfile 
name */
               free(tolock);
!          for(i=maxindex(flags);i >= 0;i--)                      /* 
clear the flags */
               flags[i]=0;
            for(tolock=0,locknext=0;;)
             { chp=skpspace(chp);


begin 644 JQ.procmail-initializer-patch
M*BHJ('-R8R]P<F]C;6%I;"YC+F]R:6<)5'5E(%-E<"`Q,2`P,#HU.3HQ-"`R
M,#`Q"BTM+2!S<F,O<')O8VUA:6PN8PE3870@075G("`R(#$X.C4U.C,U(#(P
M,#,**BHJ*BHJ*BHJ*BHJ*BHJ"BHJ*B`V-3(L-C4X("HJ*BH*("`)("`@("`@
M;G)C;VYD/2`M,3L*("`)("`@:68H=&]L;V-K*0D)("\J(&-L96%R('1E;7!O
M<F%R>2!B=69F97(@9F]R(&QO8VMF:6QE(&YA;64@*B\*("`)("`@("`@9G)E
M92AT;VQO8VLI.PHA(`D@("!F;W(H:3UM87AI;F1E>"AF;&%G<RD[:3MI+2TI
M"0D)("`O*B!C;&5A<B!T:&4@9FQA9W,@*B\*("`)("`@("`@9FQA9W-;:5T]
M,#L*("`)("`@9F]R*'1O;&]C:STP+&QO8VMN97AT/3`[.RD*("`)("`@('L@
M8VAP/7-K<'-P86-E*&-H<"D["BTM+2`V-3(L-C4X("TM+2T*("`)("`@("`@
M;G)C;VYD/2`M,3L*("`)("`@:68H=&]L;V-K*0D)("\J(&-L96%R('1E;7!O
M<F%R>2!B=69F97(@9F]R(&QO8VMF:6QE(&YA;64@*B\*("`)("`@("`@9G)E
M92AT;VQO8VLI.PHA(`D@("!F;W(H:3UM87AI;F1E>"AF;&%G<RD[:2`^/2`P
M.VDM+2D)"0D@("\J(&-L96%R('1H92!F;&%G<R`J+PH@(`D@("`@("!F;&%G
M<UMI73TP.PH@(`D@("!F;W(H=&]L;V-K/3`L;&]C:VYE>'0],#L[*0H@(`D@
8("`@>R!C:'`]<VMP<W!A8V4H8VAP*3L*
`
end




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EDC96FD8-C54F-11D7-911C-003065C496DC>