On Tue, 11 Mar 2003, Simon Byrnand wrote:

> However, by default spamc won't pass messages bigger than 256KB through
> to spamd for scanning, and it is recommended to configure procmail to
> not even bother calling spamc if the message is bigger than 256KB.
> 
> Has any one devised a way of getting around this so that large messages
> can still use the blacklisting ability of spamassassin without
> necessarily having to process the entire message ?
>
> Perhaps spamc could be designed to only pass the _headers_ through to
> spamd on messages bigger than 256KB so that the whitelist test could
> still function, even though the message is not being checked for spam in
> other ways. (EG no body tests etc, to stop spamd choking up on 5MB
> attachments)

You can do most (all?) of this with procmail and an unmodified spamc.

It was a lot easier with 2.43 than it is with 2.50, because of the MIME
body rewriting that 2.50 attempts to perform.  (One can't encapsulate the
message as a MIME body part if you don't have the entire message to play
with.)  However, it's still possible.

The following has been only minimally tested, but should be close ... it
does leave the content-type set to "text/plain" in the encapsulated MIME
body part; an exercise for the reader ...

This obviously needs a lot of rewriting if report_safe is turned off, but
putting the original body back again is much easier in that case.

---- 8< ---- snip ---- 8< ----

# If the body is too big, feed only the header to spamc
:0 Bfhw
* > 250000
| (formail -i"Content-Type: text/plain" ; \
   echo _PROCMAIL_BODY_PLACEHOLDER_) | spamc $YOUR_ARGS_HERE

:0 A
{
  # Previous recipe matched, so fix up the spamc output ...

  :0 B
  * ^_PROCMAIL_BODY_PLACEHOLDER_\/($)*--.*--$
  {
    TAIL="$MATCH"

    # Move SA's MIME-encapsulation boundary to the end of the body,
    # and remove our placeholder text along the way.
    :0 fbw
    * TAIL ?? ($)*\/--.*--
    | (sed "/^_PROCMAIL_BODY_PLACEHOLDER_/,/^$MATCH/d"; echo "$TAIL")
  }

  :0 E
  {
    # Output was not rewritten by spamc, restore old content-type

    :0 fhw
    | formail -iContent-Type -R Old-Content-Type Content-Type
    :0 fbw
    | sed /^_PROCMAIL_BODY_PLACEHOLDER_$/d
  }
}

# 250000 recipe didn't match, so run spamc as usual
:0 Efw
| spamc $YOUR_ARGS_HERE

---- 8< ---- snip ---- 8< ----



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to