fetchmail-friends
[Top] [All Lists]

[fetchmail]occasional glitch using `%F' in an mda string

2001-12-11 14:14:13
When I run fetchmail I give it the arguments of:

        -m "/usr/bin/procmail -f %F -d %T" --invisible

Occasionally fetchmail will come across a message which it cannot
determine an evelope-from address for and `%F' will be replaced
by nothing.  This causes procmail to deliver the message to the
default mailbox (typically /var/spool/mail/$LOGNAME) and whine
like so:

        procmail: Couldn't read "/home/dsp/dsp"

That happens because `-d' ends up being the argument to `-f' and
the `%T' (`dsp' in this case) was thought to be the name of the
procmailrc to use.

The solution I propose is to use a single dash (-) to replace
`%F' in the cases where the envelope-from address is unknown.
This works well with procmail, but I am not sure how other
potential MDAs will like it.  Here is a proposed and untested
patch:


diff -Naur fetchmail-5.9.5.orig/sink.c fetchmail-5.9.5/sink.c
--- fetchmail-5.9.5.orig/sink.c Thu Nov  8 17:35:11 2001
+++ fetchmail-5.9.5/sink.c      Tue Dec 11 20:41:19 2001
@@ -858,7 +858,10 @@
        /* sanitize from in order to contain *only* harmless shell chars */
        sanitize(from);
 
-       fromlen = strlen(from);
+       if ((fromlen = strlen(from)) == 0) {
+           strcpy(from, "-");
+           fromlen = 1;
+       }
     }
 
     /* do we have to build an mda string? */


Please let me know what you think about my proposed solution or
any other ideas you may have on how to resolve the problem.
Thank you.

-- 
Doug Porter <dsp(_at_)waterspout(_dot_)com>


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