Bug#650265: dma: cannot deliver mail to smtp server

2012-10-22 Thread Jonathan Nieder
Hi Peter,

Miquel van Smoorenburg wrote:

 This should go into stable too if possible.

 Description: Read reponse from smtp server up to crlf

How about this patch?  Patch is based against fc230da8, Release
dma-0.0.2010.06.17-6, 2010-10-17.

-- 8 --
From: Peter Pentchev r...@ringlet.net
Date: Sun, 25 Dec 2011 17:24:54 +0200
Subject: Add Miquel van Smoorenburg's fixes for #650265 and #650268.
---
 changelog | 10 ++
 patches/45-received.patch | 25 +
 patches/46-smtp-newline.patch | 22 ++
 patches/series|  2 ++
 4 files changed, 59 insertions(+)
 create mode 100644 patches/45-received.patch
 create mode 100644 patches/46-smtp-newline.patch

diff --git a/changelog b/changelog
index adbf56d3..48422a84 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,13 @@
+dma (0.0.2010.06.17-6+squeeze0.1) stable; urgency=low
+
+  [ Peter Pentchev ]
+  * Add the 45-received patch to fix the format of the Received header.
+Closes: #650268
+  * Add the 46-smtp-newline patch to deal with SMTP servers that may
+send a response in more than one TCP packet.  Closes: #650265
+
+ -- Jonathan Nieder jrnie...@gmail.com  Sun, 21 Oct 2012 23:42:33 -0700
+
 dma (0.0.2010.06.17-6) unstable; urgency=low
 
   * Add the 37-gnu-hurd patch to really fix the FTBFS on GNU/Hurd.
diff --git a/patches/45-received.patch b/patches/45-received.patch
new file mode 100644
index ..e6da7212
--- /dev/null
+++ b/patches/45-received.patch
@@ -0,0 +1,25 @@
+Description: Add semicolon before date in received: header
+Author: Miquel van Smoorenburg miqu...@cistron.nl
+Bug-Debian: http://bugs.debian.org/650268
+Last-Update: 2011-11-28
+
+--- a/mail.c
 b/mail.c
+@@ -174,7 +174,7 @@
+   error = fprintf(bounceq.mailf,
+   Received: from MAILER-DAEMON\n
+   \tid %s\n
+-  \tby %s (%s)\n
++  \tby %s (%s);\n
+   \t%s\n
+   X-Original-To: %s\n
+   From: MAILER-DAEMON \n
+@@ -452,7 +452,7 @@
+   Received: from %s (uid %d)\n
+   \t(envelope-from %s)\n
+   \tid %s\n
+-  \tby %s (%s)\n
++  \tby %s (%s);\n
+   \t%s\n,
+   username, getuid(),
+   queue-sender,
diff --git a/patches/46-smtp-newline.patch b/patches/46-smtp-newline.patch
new file mode 100644
index ..3d8c87bd
--- /dev/null
+++ b/patches/46-smtp-newline.patch
@@ -0,0 +1,22 @@
+Description: Read the response from an SMTP server all the way to CR/LF
+Author: Miquel van Smoorenburg miqu...@cistron.nl
+Bug-Debian: http://bugs.debian.org/650265
+Last-Update: 2011-11-28
+
+--- a/net.c
 b/net.c
+@@ -166,6 +166,14 @@
+   }
+   len += rlen;
+   }
++  /* read up to \n */
++  if (memchr(buff + pos, '\n', len - pos) == NULL) {
++  if (len  sizeof(buff))
++  continue;
++  strcpy(neterr, line too long in reply from server);
++  return (-1);
++  }
++
+   /*
+* If there is an external buffer with a size bigger than zero
+* and as long as there is space in the external buffer and
diff --git a/patches/series b/patches/series
index efed7421..62625007 100644
--- a/patches/series
+++ b/patches/series
@@ -20,3 +20,5 @@
 35-delivery-retry.patch
 36-sa_nocldwait.patch
 37-gnu-hurd.patch
+45-received.patch
+46-smtp-newline.patch
-- 
1.8.0.rc3


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#650265: dma: cannot deliver mail to smtp server

2011-11-28 Thread Miquel van Smoorenburg
Package: dma
Version: 0.0.2010.06.17-6
Severity: grave

DMA often fails to deliver mail to my smtp server, keeping messages
in the queue until they expire. They then fail to bounce as well.

That's why I set the severity to grave - it causes dataloss,
at least for me.

This is because it sometimes doesn't read the entire line
in the SMTP conversation up to \r\n. I suspect that happends when
the remote system doesn't send the entire line in one TCP packet,
which is probably unusual (it might be an anti-spam measure),
but valid. Example from strace:

10035 connect(6, {sa_family=AF_INET, sin_port=htons(25), 
sin_addr=inet_addr(194.109.6.51)}, 16) = 0
10035 read(6,  220 smtp-vbr11.xs4all.nl ESMTP Sendmail 8.13.8, 2048) = 46
10035 write(6, EHLO newsfeed5.news.xs4all.nl\r\n, 31) = 31
10035 read(6,  /8.13.8; Mon, 28 Nov 2011 11:34:52 +0100 (CET)\r\n, 2048) = 48
10035 sendto(5, 21Nov 28 11:34:52 dma[1580fa.612b00]: remote delivery 
deferred: smtp.xs4all.nl [194.109.6.51] failed after EHLO: invalid syntax in 
reply from server, 150, MSG_NOSIGNAL, NULL, 0) = 150

As you can see, dma reads the first 46 bytes of the SMTP welcome
line, then sends an EHLO, then wants to read the reply to the EHLO
but gets the rest of the SMTP welcome line, and errors out.

Mike.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#650265: dma: cannot deliver mail to smtp server

2011-11-28 Thread Miquel van Smoorenburg
tag 650265 +patch
thanks

This should go into stable too if possible.

Description: Read reponse from smtp server up to crlf
Author: Miquel van Smoorenburg miqu...@cistron.nl
Last-Update: 2011-11-28

--- a/net.c 2011-11-28 12:27:29.0 +0100
+++ b/net.c 2011-11-28 13:00:39.145291582 +0100
@@ -166,6 +166,14 @@
}
len += rlen;
}
+   /* read up to \n */
+   if (memchr(buff + pos, '\n', len - pos) == NULL) {
+   if (len  sizeof(buff))
+   continue;
+   strcpy(neterr, line too long in reply from server);
+   return (-1);
+   }
+
/*
 * If there is an external buffer with a size bigger than zero
 * and as long as there is space in the external buffer and



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org