You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2011/07/28 07:12:43 UTC

[Bug 6641] New: Bounded "tflags multiple"

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6641

             Bug #: 6641
           Summary: Bounded "tflags multiple"
           Product: Spamassassin
           Version: 3.3.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Plugins
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: jhardin@impsec.org
    Classification: Unclassified


Created attachment 4942
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=4942
Implement "tflags maxhits=N" (first attempt)

"tflags multiple" matches as many copies are as present in the message being
scanned. If the rule counting the hits fires at (say) ten hits, counting past
the tenth hit is wasted work, and can generate a great deal of wasted
processing.

Attached patch implements "tflags maxhits=N" for modifying the behavior of
"tflags multiple". Example usage:

rawbody   __MUMBLE      /mumble/
tflags    __MUMBLE      multiple maxhits=5
meta      MANY_MUMBLE   __MUMBLE=5

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6641] Bounded "tflags multiple"

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6641

--- Comment #3 from John Hardin <jh...@impsec.org> 2011-07-28 19:57:25 UTC ---
(In reply to comment #2)
> I don't understand why we need to add a new keyword "maxhits" when we can just
> extend the keyword "multiple" with an optional equals sign and an integer.

Clarity?

What if at some point in the future we wish to apply another value to control
the processing of "multiple"?

I prefer adding a new tflags keyword as that makes the meaning explicit and
doesn't complicate future extension, and also isolates the code changes a
little better; but I'll bow to consensus.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6641] Bounded "tflags multiple"

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6641

--- Comment #7 from John Hardin <jh...@impsec.org> 2011-08-02 19:38:37 UTC ---
(In reply to comment #6)
> (In reply to comment #0)
> > meta      MANY_MUMBLE   __MUMBLE=5
> 
> I believe MANY_MUMBLE would *always* fire since the evaluation of "__MUMBLE=5"
> would always be true (since there is no case in which __MUMBLE cannot be
> assigned the value of five).
> 
> I believe you wanted:  __MUMBLE==5

As may be. That example was just off the top of my head to illustrate how
"tflags maxhits=N" would be used. For real rules I never do equality tests,
only "__MUMBLE > N".

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6641] Bounded "tflags multiple"

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6641

Adam Katz <an...@khopis.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |antispam@khopis.com

--- Comment #6 from Adam Katz <an...@khopis.com> 2011-08-02 18:49:44 UTC ---
(In reply to comment #0)
> meta      MANY_MUMBLE   __MUMBLE=5

I believe MANY_MUMBLE would *always* fire since the evaluation of "__MUMBLE=5"
would always be true (since there is no case in which __MUMBLE cannot be
assigned the value of five).

I believe you wanted:  __MUMBLE==5

Meta rules are basically perl eval expressions; I've run into metas that used
the ternary operator as well as various assigned values, e.g.

meta __FOO      BAR + BAZ + BADA + BING + BANG + BOOM
meta __CEILING  __FOO > 2 ? 2 : __FOO
meta RESULT     BIZZ + BUZZ + FIZZ + __CEILING > 2

Note that I do *NOT* advocate doing this, and there are better/cleaner ways of
implementing the same logic, but I was surprised to see that this actually
works.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Re: [Bug 6641] Bounded "tflags multiple"

Posted by John Hardin <jh...@impsec.org>.
On Sun, 31 Jul 2011, bugzilla-daemon@issues.apache.org wrote:

> https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6641
>
> John Hardin <jh...@impsec.org> changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>             Status|NEW                         |RESOLVED
>         Resolution|                            |FIXED
>
> --- Comment #5 from John Hardin <jh...@impsec.org> 2011-07-31 17:09:48 UTC ---
> Committed per C-T-R policy. Reopen this bug for further discussion.

Also: spamassassin2.zones.apache.org has been brought up-to-date for this 
and other recent changes checked into SVN.

-- 
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
  5 days until the 276th anniversary of John Peter Zenger's acquittal

[Bug 6641] Bounded "tflags multiple"

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6641

John Hardin <jh...@impsec.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from John Hardin <jh...@impsec.org> 2011-07-31 17:09:48 UTC ---
Committed per C-T-R policy. Reopen this bug for further discussion.


Modified:
/home/jhardin/develop/spamassassin/svn/trunk/lib/Mail/SpamAssassin/Conf.pm
Modified:
/home/jhardin/develop/spamassassin/svn/trunk/lib/Mail/SpamAssassin/Plugin/Check.pm
Modified: /home/jhardin/develop/spamassassin/svn/trunk/t/rule_multiple.t
Committed revision 1152594.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6641] Bounded "tflags multiple"

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6641

John Hardin <jh...@impsec.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #4942|0                           |1
        is obsolete|                            |

--- Comment #4 from John Hardin <jh...@impsec.org> 2011-07-30 20:47:30 UTC ---
Created attachment 4944
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=4944
Implement "tflags maxhits=N"

Fix error in patch to URI rule processing

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6641] Bounded "tflags multiple"

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6641

D. Stussy <so...@kd6lvw.ampr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |software+spamassassin@kd6lv
                   |                            |w.ampr.org

--- Comment #2 from D. Stussy <so...@kd6lvw.ampr.org> 2011-07-28 19:31:24 UTC ---
I don't understand why we need to add a new keyword "maxhits" when we can just
extend the keyword "multiple" with an optional equals sign and an integer.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 6641] Bounded "tflags multiple"

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6641

John Hardin <jh...@impsec.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jhardin@impsec.org

--- Comment #1 from John Hardin <jh...@impsec.org> 2011-07-28 05:13:23 UTC ---
I am suspicious of the patch to the header matching, but the rest is pretty
straightforward.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.