Re: Help with filter-flags

Arthur Dent <[email protected]>
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
On Thu, 2011-08-04 at 16:34 -0600, LuKreme wrote:
> Arthur Dent <[email protected]> squaked out on Thu 04-Aug-2011 09:21
> > 
> 
> I would check if clamd is running first, then proceed only if it is.
> 
> CLAMRUN=`ps -Uroot -co command | grep "\bclamd\b"`
> 
> :0
> * CLAMRUN ?? clamd
> {
> 
> # Your existing recipes, with some fixes
> 
> }

Hi LuKreme,

This was my first idea too. Unfortunately there are other error cases I
want to catch as well as just the situation where clamd is simply not
running. For example, (this is a Fedora box) SELinux will prevent
Procmail accessing clamd even though clamd is running just fine. This
will produce an error along the lines of:
"ERROR: Can't connect to clamd: Permission denied". Another error I have
encountered is:
"ERROR: Can't connect to clamd: No such file or directory"

I want to trap these errors and report them in the headers for further
investigation.

I can modify your suggestion so that I only run my recipe if clamd does
not produce an error:

VIRUS=`${CLAMDSCAN} --no-summary --stdout -`
# If clamd is not running or there is another error:
:0
* VIRUS ?? !^ERROR
{
  recipe
}

But if I want to mark up the headers to show the failure I run into a
logic problem which I can't quite get my head around:

Pseudocode
==========

IF (no clamd error)
  {
	IF (malware detected)
	  {
		mark up headers
		deliver message to MALWARE folder
	  }
	ELSE
	  {
		mark up headers
		return to calling recipe <--- NEEDS TO EXIT HERE!
	  }
   }
ELSE
   {
	mark up headers to show clamd error
	return to calling recipe <--- OR NEEDS TO EXIT HERE!
   }

In this recipe (in production) there will be only one case where the
mail is actually delivered.

I don't know how to exit a procmail recipe and allow it to return to the
calling recipe. I have seen the SWITCHRC command - but I don't think
that is what I want here.

Thanks for all the help so far...

Mark

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
[email protected]
http://mailman.rwth-aachen.de/mailman/listinfo/procmail
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEABECAAYFAk47qCAACgkQ75heFf3niHJQiQCfQ9CH6KwDvWoMzWZ7UEVAwBeX
yQ8Anil5M3UxL5RDywd/v+/0uDbznyXt
=eDnL
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.