procmail
[Top] [All Lists]

RE: procmail - a condition .. LOOPING OOPS

2005-01-11 11:04:20
Andy [mailto:andy51(_at_)ekit(_dot_)com] wrote:

[dman wrote:]

You don't really need sed, in any case.  In
procmail, try to think procmail first and solve 
things natively if possible.

For example, to find the local part of the address
in Delivered-To:

  :0
  * ^Delivered-To: \/[^(_at_)]*
  { LOCALNAME =MATCH }

well not quite.  The local name is not the bit before the @.
There is a string before the @ that contains the local name
and I have to dump the other parts of it.  The ISP actually
gives multiple mailboxes and filters mails into them but
mangles the reipient address in this way when it does it.

I don't have the example to hand but its something like

plusz_axelrod-USERNAME(_at_)domain

and I have to extract the USERNAME value, hence
the sed.  


But you still don't need sed for that.  Procmail handles
regexes just fine.  Assuming dashes and also no dashes
in the local usernames, then:

   :0
   * ^Delivered-To:.*-\/[^(_at_)]+
   { LOCALNAME = $MATCH }  # did I really forget the
                           # dollar-sign above?  Feh!
                           # Hmm, looking back at my
                           # copy, no, I did not forget;
                           # you are mangling my text while
                           # quoting me (and also leaving
                           # off the attribution).  Please
                           # be careful about such!


Also I think the ISP puts multiple
addresses in there (after all from their p.o.v
it is delivered so they can do what they want with
that field).

Well, nobody can help work on your problem if we don't know
what the thing actually looks like.

But as I said before, you don't need it anyway, because
you already have $LOGNAME.

All these mails from one mailbox are processed by one
user (so I can use pop3 to fetch instead of smtp)
and distributed to the multiple users (which are
actually list addresses - I'm wanting to shift some
mailman work onto this box).

Okay, so then you *don't* have $LOGNAME.  That is really
ugly!  Why are you guys doing this?  It's not at all clean
to try to use procmail as an MTA.

So the trick below to avoid sed won't work either I think.

If it's not the users' own processes running procmail,
then how can messages be safely written to their spools?
If root is writing to the spools (i.e., no $DROPPRIVS
invoked), then root owns the messages.  Either the
users then can't delete them or, if they can, then
something owned by root is writeable by users, which
is not secure.

(Please don't top-quote and leave all the previous stuff in
that you have said is inapplicable anyway!  Many lines
deleted here.)

Even if you wanted to do all that above -- a hodge-podge system
that I do not at all recommend -- nevertheless, you do not
really need sed!

Dallman



____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail