procmail
[Top] [All Lists]

Special characters from recipe not escaped for the shell

2003-12-29 09:16:52
Hi, again. My recipe can break if there is an & in the subject line. Here is a 
sample log entry:

procmail: Match on ! "egrep -is -f /home/user/goodhtml.txt"
procmail: Match on "^Content-(Transer-Encoding: base64|type: 
(text/html|multipart/(mixed|alternative)))"
procmail: Executing "formail,-rzx,To:"
procmail: Assigning "SPAMMER=gogadget(_at_)netvision(_dot_)net(_dot_)il"
procmail: Executing "formail,-zx,Subject:"
procmail: Assigning "SUB=Walk & Talk"
procmail: Executing "date"
procmail: Assigning "TRAP=echo Mon Dec 29 09:34:22 CST 2003: HTML message from 
gogadget(_at_)netvision(_dot_)net(_dot_)il with subject Walk & Talk was filed 
in SPAM. 
gogadget(_at_)netvision(_dot_)net(_dot_)il was added to the spammer list. 
delete.log
echo gogadget(_at_)netvision(_dot_)net(_dot_)il >>spammerlist"
procmail: Locking "/home/user/INBOX/SPAM.lock"
procmail: Assigning "LASTFOLDER=/home/user/INBOX/SPAM"
procmail: Opening "/home/user/INBOX/SPAM"
procmail: Acquiring kernel-lock
procmail: Unlocking "/home/user/INBOX/SPAM.lock"
From gogadget(_at_)netvision(_dot_)net(_dot_)il  Mon Dec 29 09:33:44 2003
 Subject: Walk & Talk
  Folder: /home/user/INBOX/SPAM                                    5682
procmail: Assigning "EXITCODE=0"
procmail: Executing "echo Mon Dec 29 09:34:22 CST 2003: HTML message from 
gogadget(_at_)netvision(_dot_)net(_dot_)il with subject Walk & Talk was filed 
in SPAM. 
gogadget(_at_)netvision(_dot_)net(_dot_)il was added to the spammer list. 
delete.log
echo gogadget(_at_)netvision(_dot_)net(_dot_)il >>spammerlist"
Mon Dec 29 09:34:22 CST 2003: HTML message from 
gogadget(_at_)netvision(_dot_)net(_dot_)il with 
subject Walk
/bin/sh: Talk: command not found

So, the entry for delete.log is not being made. How can I modify my recipe so 
that & is escaped for the shell? (And which man page would list other special 
characters that I should probably also address?) Recipe below:

:0
* !? egrep -is -f /home/lhoffner/goodhtml.txt
* ^Content-(Transer-Encoding: base64|type: 
(text/html|multipart/(mixed|alternative)))
{
        SPAMMER=`formail -rzx "To:"`
        SUB=`formail -zx "Subject:"`
        TRAP= 'echo '`date`': HTML message from '$SPAMMER' with subject '$SUB' 
was 
filed in SPAM. '$SPAMMER' was added to the spammer list. >>delete.log
echo '$SPAMMER' >>spammerlist'

        :0:
        $MAILDIR/SPAM
}

Thanks!


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