[Mimedefang] Setting variables

Tony Nugent tony at linuxworks.com.au
Fri Aug 16 23:14:01 EDT 2002


David, this is a useful reply (as many of your posts are).

  Is anyone here gathering any of these useful hints for inclusion
  in the mimedefang FAQ or recipies pages?  Another recent example
  was the hint about syslog... I didn't realise it was so trivial to
  create syslogs (which I will soon do to log the details of any
  spam or viruses that are detected).  This one is so useful,
  perhaps a mention of it could go into the default example filter?

  BTW, it is possible to suppress logs about changes to message
  headers (unless they involve errors)?

On Fri Aug 16 2002 at 10:40, "David F. Skoll" wrote:

> On Fri, 16 Aug 2002 08:53:52 -0500 (CDT)
> Jim McCullars <jim at info.uah.edu> wrote:
> 
> > Hi, I have a question about setting variables in mimedefang-filter.  If I
> > set a global variable in, say, filter_relay, will it be there in all other
> > routines?
> 
> No.
> 
> > Or if I set it at the beginning (just under $Stupidity in the
> > example), will it be there for all of them?  I'd like to set a global
> > variable $LocalRelay one time and have it available in a couple of places.
> 
> The rules are:
> 
> - Anything you set outside a subroutine in your filter is available all
> the time.
> 
> - Anything you set inside filter_relay, filter_sender or filter_recipient
> is volatile -- it may or may not be set for any other functions.  See
> the source code to understand why. :-)
> 
> - Anything you set in filter_begin is available in filter and filter_end.
> 
> - Anything you set in filter is available in filter_end.

Just for the record and to make things even more clear...

Where is it advisable (and/or "safe") to reset or undef (custom)
variables that are need to be re-used in the filter?  For example,
if a variable is set in filter() or filter_end(), then is it still
defined and set to that value next time the filter runs?

I assume that this is the case (which is why I always reset them,
good practice anyway), but I'm guessing things are a little more
complicated than they appear.  I notice that re-reading the filter
involves restarting new slave processes... when a slave dies for
whatever reason (eg, terminated by the multiplexor or by an error),
do the new ones that are spawned always re-read the filter "fresh"
and come up with a new environment, or do they still inherit the one
that existed for the terminated slaves?  Or are there other factors
in play to muddy the waters? :)

Thanks.

> Regards,
> 
> David.

Cheers
Tony



More information about the MIMEDefang mailing list