procmail
[Top] [All Lists]

Re: Exitcode changes to zero when I asked for 67 ?

1997-09-09 13:41:50
From: vikas(_at_)insight(_dot_)att(_dot_)com
Date: Tue, 9 Sep 1997 09:33:16 -0400
Subject: Re: Exitcode changes to zero when I asked for 67 ?

| procmail: Match on "^Subject: Re: Computer Trespass"
| procmail: Assigning "LASTFOLDER=EXITCODE=67"
| procmail: Opening "EXITCODE=67"
| procmail: Acquiring kernel-lock
| procmail: Notified comsat: 
"wwgrol(_at_)64416:/usr/home/wwgrol/Mail/EXITCODE=67"
| procmail: Assigning "EXITCODE=0"

Still cant understand this. Why does the log show the explicit line
"Assigning EXITCODE=0"? It doesnt show up usually, right?

| 
| The recipe is
| 
| :0
| * condition(s) withheld in case the bomber reads this list  :-)
| EXITCODE=67

Procmail assumes that whatever comes after the conditions of a recipe
is the action of the recipe.  What you have written in place of an
action is a variable assignment, but it is misinterpreted (or correctly
interpreted, depending on your point of view) as an action because of
its place in the file.  In particular, procmail is probably taking it
to be the name of a folder because it doesn't begin with "|", "!", or
"{".

Move the variable assignment outside of a recipe and it will take
effect.  The suggestion made earlier was to make your recipe into a
block opener, and then put the variable assignment inside the block
(before any recipe you care to put in there).

If what you are trying to do is cause a delivery failure notice to go
back to the sender, there is a technique in the best_of_procmail_list
suggested by Roman Czyborra <czyborra(_at_)cs(_dot_)tu-berlin(_dot_)de>:

  :0
  * [condition-1]
  * [condition-2]
  * [...]
  {
    EXITCODE=67         # EX_NOUSER, the user specified did not exist
    HOST=BOUNCE
  }

Or pick your favorite EXITCODE from /usr/include/sysexits.h.  BTW, the
various exitcodes are meaningful to sendmail(8) but not necessarily to
any other mailer.

This technique is somewhat contradictory to the procmailrc(5) man page,
which says that a HOST= assertion failure terminates the rcfile and if
it's the last rcfile terminates procmail without "generating an error
(i.e.  to the mailer it will seem that the mail has been delivered)."
This means to me that the exit code is always 0 when a HOST= assertion
fails, but that's contrary to fact.  I've tried it myself and it
works.  I think it's the documentation, not the code, which needs to be
changed, because this is a very useful feature.

Regards, Ed

-- 
So many idiots . . . so few comets.