[Mimedefang] Setting clamd timeouts.

Jan-Pieter Cornet johnpc at xs4all.nl
Thu Sep 27 05:03:39 EDT 2007


On Wed, Sep 26, 2007 at 08:56:30PM -0800, Matthew Schumacher wrote:
> Anyway, does anyone see anything wrong with the attached patch?  I'm not
> much for programming with sockets.

The first $sock->timeout call looks right.

The second, however... doesn't work, since it's being used via IO::Select,
and that ALREADY has a timeout of 60 seconds on the PONG reply, so if
you call message_contains_virus_clamd, and clamd is stuck, you already
have an effective timeout of 60 seconds.

That routine then opens another socket a few lines down, and that
is where you'd want to add another $sock->timeout call.
 
> schu

> --- /usr/bin/mimedefang.pl      2007-08-29 09:12:12.000000000 -0800
> +++ /tmp/mimedefang.pl  2007-09-26 20:42:52.000000000 -0800
> @@ -4381,6 +4381,7 @@
>      }
>      my $sock = IO::Socket::UNIX->new(Peer => $clamd_sock);
>      if (defined $sock) {
> +        $sock->timeout(20);
>         my $path = $entity->bodyhandle->path;
>         # If path is not absolute, add cwd
>         if (! ($path =~ m+^/+)) {
> @@ -4452,6 +4453,8 @@
>         return (wantarray ? (999, 'cannot-execute', 'tempfail') : 999);
>      }
> 
> +    $sock->timeout(20);
> +
>      my $s = IO::Select->new();
>      $s->add($sock);
>      if (!$s->can_write(30)) {
> 

-- 
Jan-Pieter Cornet <johnpc at xs4all.nl>
!! Disclamer: The addressee of this email is not the intended recipient. !!
!! This is only a test of the echelon and data retention systems. Please !!
!! archive this message indefinitely to allow verification of the logs.  !!



More information about the MIMEDefang mailing list