I'm reopening this thread as I independently ran into it today, and I still
don't see it in the Git repo. 

I've attached a simpler patch than the previous version as well, it's
had a few hours of testing only.

A user tried to subscribe to a mailing list I run, and pinged me after 2 days
because his sub request hadn't gone through.

It was being handled incorrectly by qpsmtpd, such that $transaction->header was
undef.

The user's MTA was an up to date Ubuntu LTS Postfix, and his MUA is Thunderbird
10.

==
< DATA
> 354 go ahead
< Received: from mail.EXAMPLE.COM (localhost [127.0.0.1])
<         by mail.EXAMPLE.COM (Postfix) with ESMTP id 8CE3D40B93
<         for <vhs-general-subscr...@lists.hackspace.ca>; Thu, 23 Feb 2012 
05:15:33 +0000 (UTC)
< DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=EXAMPLE.COM;
<         s=mail; t=1329974133;
<         bh=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN/XKdLCPjaYaY=;
<         h=Message-ID:Date:From:MIME-Version:To:Content-Type:
<          Content-Transfer-Encoding;
<         b=WJi1NKkoafASk0xmEx9trfC0+EnTFQoLGKKaw/+iWYRwNuTFG62rhyOqaMXie/Jy3
<          zK7LZsg2FQFEhE0Gmx/+8UScndrUQUz+lBdEUw9uIPYqcrS06gCmnteu+oqCn+n5rB
<          s4SZfgDxYAPDtuvlrsxoNEnOqCf68jKHPnJamSoQ=
< Received: from [10.10.30.124] (unknown [AA.BB.CC.DD])
<         by mail.EXAMPLE.COM (Postfix) with ESMTPSA
<         for <vhs-general-subscr...@lists.hackspace.ca>; Thu, 23 Feb 2012 
05:15:29 +0000 (UTC)
< Message-ID: <4f45cbdc.9070...@example.com>
< Date: Wed, 22 Feb 2012 21:17:16 -0800
< From: USER <u...@example.com>
< User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20120208 
Thunderbird/10.0.1
< MIME-Version: 1.0
< To: vhs-general-subscr...@lists.hackspace.ca
< Content-Type: text/plain; charset=ISO-8859-1; format=flowed
< Content-Transfer-Encoding: 7bit
< .
> 451 Queuing declined or disabled; try again later
===

In my logs, fun stuff like this:
FATAL PLUGIN ERROR [spamassassin]:  Can't call method "as_string" on an 
undefined value at /usr/share/qpsmtpd/plugins/spamassassin line 154, <STDIN> 
line 9.
FATAL PLUGIN ERROR [queue::qmail_2dqueue]:  Can't call method "print" on an 
undefined value at /usr/share/qpsmtpd/plugins/queue/qmail-queue line 59, 
<STDIN> line 9.

-- 
Robin Hugh Johnson
Gentoo Linux: Developer, Trustee & Infrastructure Lead
E-Mail     : robb...@gentoo.org
GnuPG FP   : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
Accept messages with no body.

If a message has no body, there is nothing in the RFC spec that says it
needs to have a trailing \n for a blank line after the headers.

Thumderbird 10 generates some emails like this, which will always cause
plugin errors when $transaction->header is accessed otherwise, as there
is almost no checking that $transaction->header is defined before usage.

Signed-off-by: Robin H. Johnson <robb...@gentoo.org>
Thanks-To: Jack Bates <ms...@freezone.co.uk>

--- qpsmtpd-0.83.orig/lib/Qpsmtpd/SMTP.pm       2009-04-03 06:24:21.000000000 
+0000
+++ qpsmtpd-0.83/lib/Qpsmtpd/SMTP.pm    2012-02-25 05:52:14.000000000 +0000
@@ -632,7 +632,7 @@
 
   my $timeout = $self->config('timeout');
   while (defined($_ = $self->getline($timeout))) {
-    $complete++, last if $_ eq ".\r\n";
+    $complete++, $_ = '' if $_ eq ".\r\n";
     $i++;
 
     # should probably use \012 and \015 in these checks instead of \r and \n 
...
@@ -648,7 +648,7 @@
     unless (($max_size and $size > $max_size)) {
       s/\r\n$/\n/;
       s/^\.\./\./;
-      if ($in_header and m/^$/) {
+      if ($in_header and (m/^$/ or $complete > 0)) {
         $in_header = 0;
         my @headers = split /^/m, $buffer;
 
@@ -691,9 +691,10 @@
 
       # copy all lines into the spool file, including the headers
       # we will create a new header later before sending onwards
-      $self->transaction->body_write($_);
+      $self->transaction->body_write($_) unless $complete;
       $size += length $_;
     }
+    last if $complete > 0;
     #$self->log(LOGDEBUG, "size is at $size\n") unless ($i % 300);
   }
 

Attachment: signature.asc
Description: Digital signature

Reply via email to