I have a rc.local.00 recipe modified from Rob Lingelbach <rob@alegria.com> to catch multipart/html/coded/... mails which has been working well for quite a while. Recently I noticed some mails sneaked through my list. I checked everything and could not find a clue. I attach the log error and a sample of the rc below and hope some of you could spot some syntex error that is obvious to you but not to me ;-) Thanks in advance! Zhiliang PS: Due to the mail editor the copied lines were forced some extra line breaks -- in my recipe I do have proper line breaks/continuations ("\") -------- log -------- procmail: Error while writing to " formail -r -i "From: $listreq" -A"X-Loop: $listaddr" | \ (/usr/bin/cat; /usr/bin/cat info/reject.attach $tmprequest) | \ $SENDMAIL -t " --------------------- rc.local.s00 (sample) --------------------- # Modified from Rob Lingelbach rob@alegria.com tmprequest=tmp_request :0 c | /usr/bin/cat > $tmprequest :0 BH * ^This is a multi-part message* { :0 c | formail -i "Listmaster: <--Intercepted for multi contents-->"| \ $SENDMAIL -oi $maintainer :0 | formail -r -i "From: $listreq" -A"X-Loop: $listaddr" | \ (/usr/bin/cat; /usr/bin/cat info/reject.attach $tmprequest)|\ $SENDMAIL -t } :0 BH * ^Content-Type:.*(multipart|enriched|coded|mixed) { :0 c | formail -i "Listmaster: <--Intercepted for enriched content-->"| \ $SENDMAIL -oi $maintainer :0 | formail -r -i "From: $listreq" -A"X-Loop: $listaddr" \ -i "Listmaster: <--Intercepted for Enriched content-->" | \ (/usr/bin/cat; /usr/bin/cat info/reject.attach $tmprequest) | \ $SENDMAIL -t }
Zhiliang Hu <hu@genome.ansci.iastate.edu> writes:
I have a rc.local.00 recipe modified from Rob Lingelbach <rob@alegria.com> to catch multipart/html/coded/... mails which has been working well for quite a while. Recently I noticed some mails sneaked through my list. I checked everything and could not find a clue. I attach the log error and a sample of the rc below and hope some of you could spot some syntex error that is obvious to you but not to me ;-) ... procmail: Error while writing to " formail -r -i "From: $listreq" -A"X-Loop: $listaddr" | \ (/usr/bin/cat; /usr/bin/cat info/reject.attach $tmprequest) | \ $SENDMAIL -t " ... :0 | formail -r -i "From: $listreq" -A"X-Loop: $listaddr" | \ (/usr/bin/cat; /usr/bin/cat info/reject.attach $tmprequest)|\ $SENDMAIL -t }
procmail doesn't like it if it gets a write error when feeding the message into an action. This will happen if the action doesn't read in the entire message by more than what is buffered by the kernel. formail, when given the -r flag and not the -k flag doesn't want or need the body, so it will stop reading its input once it hits the blank line that terminates the header. Since nothing in the rest of the action above reads the rest of the data from procmail (i.e., the body) procmail will get a write error if the body won't fit inside the kernel pipe buffers. The solution, of course, is to put the 'h' flag on the recipe, so that procmail will only write the header to the pipe. There's also no need to call cat twice: :0 h | ( formail -r -i "From: $listreq" -A"X-Loop: $listaddr"; \ cat info/reject.attach $tmprequest \ ) | $SENDMAIL $SENDMAILFLAGS -t The same goes for the other invocation of formail with the -r flag. Philip Guenther
participants (2)
-
guenther+smartlist@gac.edu
-
Zhiliang Hu