procmail
[Top] [All Lists]

Re: trouble with shell in passwd

2002-04-04 18:30:10
Roman Terleev <lost(_at_)InfoNET(_dot_)uz> writes:
It is necessary for me to use procmail for copying messages in files.
Has made procmailrc:
...
NFI=`formail -xFrom:`
MFI=`expr "$NFI" : '.* <*\((_dot_)*(_at_)(_dot_)*\(_dot_)[A-z,0-9]*\)>*.*'`

(What if the expr fails because the regexp doesn't match?)

This would be a faster way of doing the above:
        :0
        * ^From:.* <*\/(_dot_)*(_at_)(_dot_)*\(_dot_)[A-Z,0-9]*
        { MFI = $MATCH }
        :0 E
        { MFI = "couldn't find address in from" }

Perhaps more _accurate_ would be to use the version on the procmailex(5)
manpage:
        FROM = `formail -rt -xTo:`


NTI=`formail -xTo:`
MTI=`expr "$NTI" : '.* <*\((_dot_)*(_at_)(_dot_)*\(_dot_)[A-z,0-9]*\)>*.*'`

Much of the above applies here too.  Also, what if there's no To: field,
but only a Cc:?


:0c
* ! 
^From:MAILER_DAEMON.*|root.*|postmaser.*|operator.*|uucp.*|daemon.*|informix.*
* ^To:.*infonet.uz.*

The first condition will probably never match as there will almost always
be whitespace after the colon.  Why don't you just use
        * ! ^FROM_DAEMON
?  (It's described in the procmailrc(5) manpage, near the bottom, and
appear several times in the procmailex(5) manpage.)



| /bin/cat > /tmp/mI.`date +%y-%b-%d-%H%M`-$MTI-$MFI; \
/usr/local/rar/rar m -m5 -rr -ep -ag /var/log/MAIL.ARCHIVE/mail_in_`date 
+%y-%b`.rar /tmp/mI.*

So you accumulate files in /tmp named mI.<stuff> and make rar reparse
them all each time?  Ick.  Doesn't it have some way to just add individual
messages to its existing collection, preferably when fed the message on
its stdin?  Is the temporary file really necessary?


And procmail does not handle those users for whom is /bin/false in passwd.

Putting SHELL=/bin/sh at the top of the rcfile will fix that.


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

<Prev in Thread] Current Thread [Next in Thread>