On Sat, 16 Feb 2008 21:17:46 -0800
Robert Spier <[EMAIL PROTECTED]> wrote:

> this change will probably aggravate Qpsmtpd::Apache.  Improvements
> welcome.
Why don't you use a read timeout on the SA-Socket like we do in the
earlytalker plugin? This time of course the other way: bail out if we
can't read. Diff is w/o the config stuff and completely untested:

Index: plugins/spamassassin
===================================================================
--- plugins/spamassassin        (revision 846)
+++ plugins/spamassassin        (working copy)
@@ -79,7 +79,9 @@
 use Qpsmtpd::DSN;
 use Socket qw(:DEFAULT :crlf);
 use IO::Handle;
+use IO::Select;
 
+
 sub register {
   my ($self, $qp, @args) = @_;
 
@@ -163,6 +165,15 @@
   print SPAMD CRLF;
   shutdown(SPAMD, 1);
   $self->log(LOGDEBUG, "check_spam: finished sending to spamd");
+
+  my $sa = new IO::Select;
+  $sa->add(\*SPAMD) || return DECLINED;
+  unless ($sa->can_read($self->{timeout})) {
+    $self->qp->respond(451, "An error occured while processing your mail. (#SA)
");
+    $self->log(LOGERROR, "spamassassin timeout");
+    exit(1);
+  }
+
   my $line0 = <SPAMD>; # get the first protocol lines out
   if ($line0) {
     $self->log(LOGDEBUG, "check_spam: spamd: $line0");


> I suspect we need a general timeout mechanism for plugin dispatches.
> Right now, we only timeout input.
Agreed.

        Hanno

Reply via email to