fetchmail-friends
[Top] [All Lists]

[fetchmail] [PATCH] fetchmail 6.2.4: fix nasty SIGSEGV sink.c with daemon + limit.

2003-09-24 15:14:17
Eric, fetchmail users,

I have been really annoyed by some bug that I thought was a Heisenbug,
but it wasn't.

The problem is a SIGSEGV that happens when

a. daemon mode is active
b. size limits are active
c. -N is NOT being used

(these together let fetchmail send "oversized message" warnings)

d. the local listener refuses to accept a mail from
fetchmail-daemon(_at_)localhost (rather common)

The only symptom I had in a long time was "fetchmail daemon dies,
Postfix logs two connection losses, one after FROM, one after DATA". I
was finally able to catch and track the bug down, it was a SIGSEGV (null
dereference).

I have a band-aid fix to let fetchmail continue to run, enclosed below.

The fix also prevents fetchmail from stuffing a "Data:" header down to
the SMTP listener when status is nonzero.

There are two issues that remain:

#1 if the "oversized message warning" mail bounces, the bounce has no
useful information, the undeliverable message looks like this:
(body only)
| --foo-mani-padme-hum-16446-4018-1064440839
| Content-Type: text/plain
| 
| General SMTP/ESMTP error.
| 
| 
| --foo-mani-padme-hum-16446-4018-1064440839
| Content-Type: message/delivery-status
| 
| Reporting-MTA: dns; localhost
| 
| Final-Recipient: rfc822; emma(_at_)localhost
| Last-Attempt-Date: Thu, 25 Sep 2003 00:00:39 +0200 (CEST)
| Action: failed
| Status: 5.0.0
| Diagnostic-Code: 554 <FETCHMAIL-DAEMON(_at_)localhost>: Sender address 
rejected: MX points to loopback address
| 
| --foo-mani-padme-hum-16446-4018-1064440839
| Content-Type: text/rfc822-headers
| 
| 
| --foo-mani-padme-hum-16446-4018-1064440839--

The real fix would be to generate the headers earlier so the bounce
wasn't empty...

#2 there is no official way to force fetchmail to use a REAL bounce
sender address. I still need to use an old workaround, one line in
.fetchmailrc:

skip dummy.invalid with proto ETRN no dns

Here's the band-aid patch, please apply and release 6.2.5 ASAP.

diff -u fetchmail-6.2.4/sink.c fetchmail-6.2.4-ma1/sink.c
--- fetchmail-6.2.4/sink.c      2003-08-06 06:26:28.000000000 +0200
+++ fetchmail-6.2.4-ma1/sink.c  2003-09-24 23:59:41.000000000 +0200
@@ -390,7 +390,7 @@
     SockPrintf(sock, "--%s\r\n", boundary); 
     SockPrintf(sock, "Content-Type: text/rfc822-headers\r\n");
     SockPrintf(sock, "\r\n");
-    SockWrite(sock, msg->headers, strlen(msg->headers));
+    if (msg->headers) SockWrite(sock, msg->headers, strlen(msg->headers));
     SockPrintf(sock, "\r\n");
     SockPrintf(sock, "--%s--\r\n", boundary); 
 
@@ -1479,7 +1479,7 @@
     }
     else                               /* send to postmaster  */
        status = open_sink(ctl, &reply, &good, &bad);
-    stuff_warning(ctl, "Date: %s", rfc822timestamp());
+    if (status == 0) stuff_warning(ctl, "Date: %s", rfc822timestamp());
     return(status);
 }
 

-- 
Matthias Andree

Encrypt your mail: my GnuPG key ID is 0x052E7D95

<Prev in Thread] Current Thread [Next in Thread>
  • [fetchmail] [PATCH] fetchmail 6.2.4: fix nasty SIGSEGV sink.c with daemon + limit., Matthias Andree <=