I'll apologize in advance here, this is really a maildrop question, but after posting there three times I haven't received an answer to what should be a simple question (not even an admonishment or flame from Mr. Sam)...

I found a nice network-ready clamd client that I want to use:


That allows me to do virus-scanning on another set of boxes; all the other clients assume a local clamd server, which is no good.

It's pretty simple, you feed it a message and it returns a clean exit code if there's no virus. If there is a virus it prints the name to STDOUT and exits with exitcode 65. Simple, right?

So I hacked together a simple rule in my local mailfilter rule like so to test it:

if ( $SIZE < 262144 )
        VIRUS=`/usr/local/bin/clamd-stream-client -t 6 -d clamd.local`
        log $RETURNCODE
        log $VIRUS
        if ($RETURNCODE == 65)
                `test -d ./Maildir/.Virus`
                if( $RETURNCODE != 0 )
                        log "= CREATING VIRUSDIR"
                        `maildirmake -f Virus ./Maildir`
                        log "= SUBSCRIBING VIRUSDIR"
                        `echo INBOX.Virus >> ./Maildir/courierimapsubscribed`

         to $VDIR/Maildir/.Virus

And it does work. I wanted to refine that a bit so I could either log what virus was found, or do a subject rewrite - either requires me to know what the virus was.

The problem is $VIRUS never gets populated. I did test that in fact it's writing to STDOUT and not STDERR, and according to the maildrop docs, the backticks should take anything on STDOUT and stuff it into that $VIRUS variable. But it doesn't... Any ideas?



Reply via email to