S Semple [mailto:stevesemple(_at_)lycos(_dot_)com] asked:
On Tue, 18 Feb 2003 01:49:42
Dallman Ross wrote:
However, I can tell you right now that is going to overrun LINEBUF
in a jiffy. Much better to run fgrep on /etc/passwd against
what is found in the To: or Cc: headers.
I'm not sure how to do that ? The problem started with
flagging all message that have the right domain but the wrong
users from the passwd file. How would you suggest that it be
done, to prevent possible buffer overflows ?
I had saved this message to see if I could offer further ideas,
but I've been overwhelmed with work, so I'm going to pass on
the fgrep formuala. However, returning to the sed method, if
how many users do you have? as Tony said, it'll work fine if
this isn't a huge system with hundreds and hundreds of users.
USERS = \
"(`sed 's/\*.*//; s/:/|/' /etc/passwd | tr -dc
'[a-zA-Z0-9|]'`DUMMY)"
Actually, we don't even need the tr, now that I've thought about it
some more. Either of these would work:
USERS = (`sed 's/\*.*//; s/:/|\\\/' /etc/passwd`DUMMY)
USERS = (`sed 's/\*.*//; s/:/|/' /etc/passwd | tr -d '\012'`DUMMY)
The first gives a result something like
procmail: Assigning "USERS=(root|\
daemon|\
operator|\
bin|\
abs|\
news|\
games|\
staph|\
accnt|\
sendmail|\DUMMY)"
And the second:
procmail: Assigning \
"USERS=(root|daemon|operator|bin|abs|news|games|staph|accnt|sendmail|DUM
MY)"
but at the cost of an extra pipe and process (tr).
The all-awk solution somebody gave was also kind of cool. I think the
sed one is faster, though.
Dallman
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail