Ok, here goes the story:
0. stop qmail-smtpd
1. list your local domain as smarthost in SMTP routes
2. kill the postmaster aliases, we're sure that the smarthost has a
postmaster and proper virtual mapping and will catch the mail.
3. run qmqpd.
4. inject a mail with incomplete last line through QMQP.
What happens now:
1. qmail-remote fails to deliver the mail via SMTP, "partial final line"
2. qmail-send creates a bounce, qmail-remote again fails
3. qmail-send tries to contact the postmaster, qmail-remote again fails
4. qmail-send discards the bounce. Mail and bounce are lost.
Reliable workaround: stop running qmail-qmqpd, inject mail through
qmail-smtpd and qmail-inject instead.
I know that SMTP cannot transfer mail with incomplete last line,
qmail-remote mentions that.
But how come qmail-qmqpd accepts mail that cannot be delivered across
all transport and that cannot be bounced?
On a related issue, qmqp is not faster than smtp. SMTP must be
implemented anyhow, two competing protocols just make the testing less
thorough.
"Keep it simple, stupid." qmail-send was a tad too stupid when creating
the bounce. It must be able to ultimately send its bounce across SMTP,
lest it be accused of trashing innocent mail.
And that's what you get for ignoring RFC-1894 and 2045..2049 for your
bounces, they also fail.
The PROPER fix would be to reencode the mail (at least the bounce) to
base64 or at least to send an RFC-1894 compliant bounce so the bounces
survive.
There is no way QSMBF can handle truncated final lines across SMTP
transports. RFC-1894 can handle that.
Time for qmail-1.04, here's the suggested fix. It will change the bounce
message, but we must do so to get the mail through SMTP.
Makes me wonder why no-one found this earlier.
--- ./qmail-send.c.orig Mon Jun 15 12:53:16 1998
+++ ./qmail-send.c Fri Sep 7 19:46:18 2001
@@ -740,9 +740,16 @@
qmail_fail(&qqt);
else
{
+ char l = '\n';
+
substdio_fdbuf(&ssread,read,fd,inbuf,sizeof(inbuf));
while ((r = substdio_get(&ssread,buf,sizeof(buf))) > 0)
+ {
+ l = buf[r-1];
qmail_put(&qqt,buf,r);
+ }
+ if (l != '\n')
+ qmail_put(&qqt,"\n",1);
close(fd);
if (r == -1)
qmail_fail(&qqt);
Here are the logs:
999881258.617612 status: local 0/10 remote 0/20
999881273.172608 new msg 571393
999881273.172735 info msg 571393: bytes 3164 from <[EMAIL PROTECTED]> qp
11205 uid 500
999881273.284474 starting delivery 1: msg 571393 to remote
[EMAIL PROTECTED]
999881273.284593 status: local 0/10 remote 1/20
999881273.351549 delivery 1: failure:
SMTP_cannot_transfer_messages_with_partial_final_lines._(#5.6.2)/
999881273.351669 status: local 0/10 remote 0/20
999881273.502178 bounce msg 571393 qp 11214
999881273.502305 end msg 571393
999881273.503158 new msg 571400
999881273.503263 info msg 571400: bytes 3765 from <> qp 11214 uid 1013
999881273.591405 starting delivery 2: msg 571400 to remote
[EMAIL PROTECTED]
999881273.591526 status: local 0/10 remote 1/20
999881273.601885 delivery 2: failure:
SMTP_cannot_transfer_messages_with_partial_final_lines._(#5.6.2)/
999881273.602008 status: local 0/10 remote 0/20
999881273.759263 bounce msg 571400 qp 11216
999881273.759385 end msg 571400
999881273.760188 new msg 571396
999881273.760630 info msg 571396: bytes 4265 from <#@[]> qp 11216 uid 1013
999881273.861807 starting delivery 3: msg 571396 to remote
[EMAIL PROTECTED]
999881273.862230 status: local 0/10 remote 1/20
999881273.873168 delivery 3: failure:
SMTP_cannot_transfer_messages_with_partial_final_lines._(#5.6.2)/
999881273.873893 status: local 0/10 remote 0/20
999881273.874255 triple bounce: discarding bounce/571396
999881273.874548 end msg 571396
Here's the configuration:
/var/qmail/control/me
emma1.emma.line.org
/var/qmail/control/defaultdomain
emma.line.org
/var/qmail/control/plusdomain
emma.line.org
/var/qmail/control/locals
/var/qmail/control/rcpthosts
localhost
emma1.emma.line.org
/var/qmail/control/smtproutes
:emma1.emma.line.org
--
Matthias Andree
Outlook (Express) users: press Ctrl+F3 for the full source code of this post.
begin dont_click_this_virus.exe
end