procmail
[Top] [All Lists]

RE: echo pipe defeating recipe delivery

2003-12-29 01:55:37


-----Original Message-----
From: procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
[mailto:procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE]On Behalf Of 
Lee Hoffner
Sent: Sunday, December 28, 2003 11:26 PM
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
Subject: echo pipe defeating recipe delivery


I have the following recipe to deal with HTML messages (a spam combatting
tactic):

:0
* !? egrep -is -f /home/user/goodhtml.txt
* ^Content-(Transer-Encoding: base64|type:
(text/html|multipart/(mixed|alternative)))

This is a nit, but I don't know what the RFC says about the single white
space
after the ':' (colon) character. I think there could be multiple white space
characters although they seem never to appear in nature. Someone more
knowledgeable
can correct the record. Thus:

:0
* !? egrep -is -f /home/user/goodhtml.txt
*
Content-(Transer-Encoding:[     ]*base64|type:[         
]*(text/html|multipart/(mixed|
alternative)))

where the characters within [] above are <space><tab>.

{
      :0 hwf
      SPAMMER=|formail -rzx "To:"

      :0 hwf
      SUB=|formail -zx "Subject:"


This is simpler:

        SPAMMER=`formail -rzxTo:`
        SUB=`formail -zxSubject:`

      :0 f
      | echo "`date`: HTML message: from ($SPAMMER), subject
($SUB) filed in SPAM.
$SPAMMER was added to the spammer list." >>delete.log


I removed the # from the ":0 f" above. As that recipe stands, you are
filtering
the e-mail message through echo, and that is likely not what you intended.

      :0 f
      | echo "$SPAMMER" >>spammerlist


Same here.

As I read the above two actions, you'll end up with a null message body,
because the
output of the filter is null.

      :0
      $MAILDIR/SPAM

You had the lock at the higher level, but it makes more sense here.

}

If I comment out the lines where the actions are echoed to
delete.log and to
spammerlist (as shown above), the message is delivered to SPAM. If I
uncomment those lines, the log shows procmail as delivering 1
byte to SPAM.


It'd be interesting to see what your procmail log says, assuming that you
have LOGFILE defined. I don't know what procmail does with a free-standing
pipe ('|') symbol hanging out inside a recipe. I tried this and saw
something
like the following in the log file"

"procmail: Skipped "| echo xyz"

It looks like procmail just skipped over those echo statements when you
removed
the ':0 f'.

I've scoured the man pages and can't find anything that relates
to using echo.

It isn't really about 'echo'. It is about the syntax of procmail recipes.

Do any of you know why these lines would disrupt the intended
delivery of my
message?

See above.

Rewrite:

:0
* !? egrep -is -f /home/user/goodhtml.txt
*
Content-(Transer-Encoding:[     ]*base64|type:[         
]*(text/html|multipart/(mixed|
alternative)))
{
  SPAMMER=`formail -rzxTo:`
  SUB=`formail -zxSubject:`
  TRAP='echo "`date`: HTML message: from ($SPAMMER), subject ($SUB) filed in
SPAM.
$SPAMMER was added to the spammer list." >> delete.log
echo "$SPAMMER" >> spammerlist'
  :0:
  $MAILDIR/SPAM
}



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail