fetchmail-friends
[Top] [All Lists]

[fetchmail] [PATCH] Re: bouncing on empty return-path

2003-01-05 22:54:28
Quoting from Benjamin Drieu's mail on Fri, Jan 03, 2003 at 03:08:20PM +0100:
When fetchmail POPs a message from the pop3 server that has a
"Return-Path: <>" header in it, fetchmail forwards it to the local SMTP
listener using the address from the "From:" header or
"username(_at_)pophostname" if no "From:" header is given.

So if I receive a bounce (or a 'your mail has been delivered') message and
for some reason it can't be delivered on my local system, a bounce message
is sent to (in most cases) the remote postmaster. If that site is running
fetchmail as well, we may end up with a mail loop.

I added a few lines (diff attached) that made it work for me. It seems to
me that handling empty return-paths was only partially implemented
(e.g. in reply_hack() in rfc822.c), but never finished.

This patch will cause an error while using an mda where special shell
characters are replaced by '_'. There, the address "<>" will be
replaced by "__" (not tested this).

However, the basic idea of the patch is right. My suggestion is that a
from address of "MAILER-DAEMON" be used instead.

Here is a patch which does that:

=============================================
diff -Naur fetchmail-6.2.0.orig/transact.c fetchmail-6.2.0/transact.c
--- fetchmail-6.2.0.orig/transact.c     Tue Nov 26 09:34:56 2002
+++ fetchmail-6.2.0/transact.c  Mon Jan  6 10:41:37 2003
@@ -679,6 +679,8 @@
         */
        if (!strncasecmp("Return-Path:", line, 12) && (cp = nxtaddr(line)))
        {
+           if (cp[0] == '\0')  /* nxtaddr() strips the brackets... */
+               cp = "MAILER-DAEMON";
            strncpy(msgblk.return_path, cp, sizeof(msgblk.return_path));
            msgblk.return_path[sizeof(msgblk.return_path)-1] = '\0';
            if (!ctl->mda) {
=============================================

-- 
Sunil Shetye.

<Prev in Thread] Current Thread [Next in Thread>