Hello, courier users.
I can't start working with my perlfilter (based on
perlfilter-example.pl)
It's correctly setted up with filterctl.
courierfilter also started and must work with smtp and local messages.
I have seen 5 perlfilter processes in ps output, but not one got
incoming letters.
Socket /var/lib/courier/filters/perlfilter also exists and readable by
perlfilter process
(perlfilter processes and socket owned by user daemon)
I use courier-0.37.3 on Debian Woody (3.0) Linux distributive.

Code of my perlfilter is below:

#!/usr/bin/perl
# Filter for connect Courier MTA to Amavis/ClamAV pair
# based on perlfilter-example.pl
# author: Serge Sivkov [EMAIL PROTECTED]

use IO::File;

# The number of the filedescriptor that's connected to the socket is
# passed to us on STDIN.

my $filedesc=shift @ARGV;

my $socket=new IO::File "+<&$filedesc";

my $cfg_amavis_socket = '/var/run/amavis/socket.amavis';
my $amavis = IO::Socket::UNIX->new($cfg_amavis_socket);

die "$!" unless defined $socket;

my $line;
my $first=1;

#
# Read lines from the socket.  Each line contains a filename.  An empty line
# terminates the list.  The first line is the filename of the datafile
# containing the message text.  The subsequent lines are filename(s) of
# control files.
#

my $msg;

while (defined ($line=<$socket>)) {

        chomp $line;
        last unless $line;

        if ($first) {
                $msg = filterdata($line);
        }
        $first=0;
}

print $socket $msg;

$socket->close;

sub filterdata() {
        my $filename=shift;
        return "200 Ok but AMaViS not started\r\n" unless $amavis;
        $amavis->send($filename,0);
        my $response;
        return "200 Ok but AMaViS not available\r\n" unless defined 
$amavis->recv($response,1024,0);
        return $response;
}

sub filtercontrol()
{
my $filename=shift;

return "";
}



-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm 
Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to